Hardware Reference
In-Depth Information
int
lightLevel
=
analogRead(A0);
// Measure pressure & temperature from BMP sensor
sensors_event_t
event;
bmp.getEvent(
&
event);
float
pressure
=
event.pressure;
bmp.getTemperature(
&
temperature);
float
seaLevelPressure
=
SENSORS_PRESSURE_SEALEVELHPA;
float
altitude;
altitude
=
bmp.pressureToAltitude(seaLevelPressure,
event.pressure,
temperature);
if
(debug_mode
==
true
){
Serial.println(
"
\n
Calling the AppendRow Choreo..."
);
}
// Append data to Google Docs sheet
runAppendRow(humidity, lightLevel, pressure, temperature, altitude);
// Repeat every 10 minutes
delay(
600000
);
}
// Function to add data to Google Docs
void
runAppendRow
(
float
humidity,
int
lightLevel,
float
pressure,
float
temperature,
float
altitude) {
TembooChoreo AppendRowChoreo;
// Invoke the Temboo client
AppendRowChoreo.begin();
// Set Temboo account credentials
AppendRowChoreo.setAccountName(TEMBOO_ACCOUNT);
AppendRowChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
AppendRowChoreo.setAppKey(TEMBOO_APP_KEY);
// Identify the Choreo to run
AppendRowChoreo.setChoreo(
"/Library/Google/Spreadsheets/AppendRow"
);
// your Google username (usually your email address)
AppendRowChoreo.addInput(
"Username"
, GOOGLE_USERNAME);
// your Google account password
AppendRowChoreo.addInput(
"Password"
, GOOGLE_PASSWORD);
// the title of the spreadsheet you want to append to
AppendRowChoreo.addInput(
"SpreadsheetTitle"
, SPREADSHEET_TITLE);