I have successfully been able to post data on my spreadsheet using an older version of the code but now I get an error after uploading my sketch to my Yun.
I have attached my old and new code. My TembooAccount.h file is not included, but it remains unchanged from old to new.
I have a google spreadsheet named YunB with lettered values in the first row as I did for my working spreadsheet YunA.
The error I get on the serial monitor is:
Error
A Step Error has occurred: "An input error has occurred. RowData and SpreadsheetTitle are required.". The error occurred in the Stop (Missing request parameters) step.
HTTP_CODE
500
Any help would be greatly appreciated and let me know if any more information is needed to help.
I have been able to solve my problem. It turned out to be a RAM problem, which was solved by deleting an unnecessary (to me) section of the sketch that sent an email notification.
I have included the updated code for anyone else who may encounter this problem:
// Include required libraries
#include <Bridge.h>
#include <Temboo.h>
#include <Process.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
// Contains Temboo account information
#include "TembooAccount.h"
// Variables
int lightLevel;
float humidity;
float temperature;
unsigned long time;
// Process to get the measurement time
Process date;
// Your Google Docs data
const String GOOGLE_USERNAME = "myrealemail@gmail.com";
const String GOOGLE_PASSWORD = "myrealpassword";
const String SPREADSHEET_TITLE = "Yun";
// Include required libraries
#include "DHT.h"
// DHT11 sensor pins
#define DHTPIN 8
#define DHTTYPE DHT11
// DHT & BMP instances
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
// Debug mode ?
boolean debug_mode = true;
void setup() {
// Start Serial
if (debug_mode == true){
Serial.begin(115200);
delay(4000);
while(!Serial);
}
// Initialize DHT sensor
dht.begin();
// Start bridge
Bridge.begin();
// Start date process
time = millis();
if (!date.running()) {
date.begin("date");
date.addParameter("+%D-%T");
date.run();
}
if (debug_mode == false){
Serial.println("Setup complete. Waiting for sensor input...\n");
}
// Initialise the sensor
if(!bmp.begin())
{
if (debug_mode == true){Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");}
while(1);
}
}
void loop() {
// Measure the humidity & temperature
humidity = dht.readHumidity();
// 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("\nCalling the /Library/Google/Spreadsheets/AppendRow Choreo...");
}
// Append data to Google Docs sheet
runAppendRow(humidity, pressure, temperature, altitude);
// Repeat every 10 minutes
delay(600000);
}
// Function to add data to Google Docs
void runAppendRow(float humidity, 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);
// Restart the date process:
if (!date.running()) {
date.begin("date");
date.addParameter("+%D-%T");
date.run();
}
// Get date
String timeString = date.readString();
// Format data
String data = "";
data = data + timeString + "," + String(humidity) + "," + String(pressure) + "," + String(temperature) + "," + String(altitude);
// Set Choreo inputs
AppendRowChoreo.addInput("RowData", data);
// Run the Choreo
unsigned int returnCode = AppendRowChoreo.run();
// A return code of zero means everything worked
if (returnCode == 0) {
if (debug_mode == true){
Serial.println("Completed execution of the /Library/Google/Spreadsheets/AppendRow Choreo.\n");
}
} else {
// A non-zero return code means there was an error
// Read and print the error message
while (AppendRowChoreo.available()) {
char c = AppendRowChoreo.read();
if (debug_mode == true){ Serial.print(c); }
}
if (debug_mode == true){ Serial.println(); }
}
AppendRowChoreo.close();
}
hai,
I have used the same code available in the net to send data to the spread sheet. I am getting an error stating that my header file is not included. But I have added it to my main file following the steps"Sketch - Add file".
I have also included my header file in the main file stating: #include"TembooAcount.h"
The error is as follows:" TembooAccount.h : NO SUCH FILE OR DIRECTORY - COMPILATION TERMINATED"
Please suggest any solutions