posting sensor readings to google spreadhseet via Temboo

hi all,

I am still new but learning a ton. I am stuck on a problem here and cannot get this to function properly.

a little background: I'm building a temp control device using a relay and a dht11. This is for a home curing chamber so i can make my own salami!

I have everything working except for the functionality to post the sensor readings to a Google spreadsheet. i can post static text but not the dynamic sensor readings. here is my code for doing the posting, can you take a look and tell me what I'm missing? I think it is an issue with the sensor values not being defined as dynamic but I don't know.

thanks!

and f and h variables are defined with float values to be the readings in the correct format from the sensor.

// Set Choreo inputs
    String ClientSecretValue = "deleted for privacy, but is correct";
    AppendRowChoreo.addInput("ClientSecret", ClientSecretValue);
    String RefreshTokenValue = "deleted for privacy, but is correct";
    AppendRowChoreo.addInput("RefreshToken", RefreshTokenValue);
    String SheetNameValue = "Sheet1";
    AppendRowChoreo.addInput("SheetName", SheetNameValue);
    String sensorValue = "f,h";
    AppendRowChoreo.addInput("RowData", sensorValue);
    String SpreadsheetTitleValue = "Curing Chamber";
    AppendRowChoreo.addInput("SpreadsheetTitle", SpreadsheetTitleValue);
    String ClientIDValue = "deleted for privacy, but is correct";
    AppendRowChoreo.addInput("ClientID", ClientIDValue);

This line:

String sensorValue = "f,h";

defines the variable sensorValue as a String, specifically "f,h"

You need to convert the floats to a string, not just create a string containing the name of the variable.

Although I never followed through with the issue once upon a time I this exact problem. I think your best bet is Using the command sprintf() for sending the string. I had problems posting dynamic time with my RTC and i had fixed with code simular to this.

sprintf(MessageBodyTotal, "Current time is : %02d:%02d:%02d \n ", hour(), minute(), second());

This may not seem useful but i do suggest looking up more sprintf() pages for a better explanation on it's utility.

Goodluck!

thanks for your help. I guess what I'm not understanding is that on this page:Arduino: Have your Arduino add rows of data to a Google Spreadsheet

they have this line for taking an analog input to the google spreadsheet...

String sensorValue = (String)analogRead(A0);
AppendRowChoreo.addInput("RowData", sensorValue);

but since mine are digital I don't fully understand how to move them over.

Hi there, I work for Temboo.

String sensorValue = (String)analogRead(A0);
AppendRowChoreo.addInput("RowData", sensorValue);

The addInput function only takes character arrays or String variables as its inputs. Since analogRead returns an integer, we need to turn it into a String. To do this, we type cast analogRead's return value to a String (you can also do String(analogRead(A0))). If you are wanting to send the values stored in the variables f and h, you can do something like this:

int f = digitalRead(2);
int h = digitalRead(4);
String sensorValue = String(f) +"," + String(h);

This will produce your comma separated values in your sensorValue String.

If you have any questions, feel free to contact us at Contact | Temboo - we're always happy to help.

kbuck3, Thanks for your help!

I didn't need the int f and int h parts becasue the sensor is the DHT11 which has a temp reading and a humidity reading all in one.

I took

   String sensorValue = String(f) + "," + String(h);

and it is working!