Send data to google spreadsheet with Arduino Yún

Hey there!

I'm working in a project in which I want to send data from a sensor to a Google Spreadsheet. I am using an Arduino Yún. As advised in different internet articles, I decided to send sensor data through a Google Form via the curl command and the runShellCommand function. It turns out that the code works fine if the Arduino Yún is connected to my computer. When I unplug the Arduino and connect it to an external battery/outlet the sketch does not work. I am kind of interested in figuring out what is going on with the code (yes, I just started with Arduino...).

I paste the code below... in the variable value is where the sensor data goes:

Thanks a lot guys!
Raimon

#include <Process.h>

void setup()
{
Bridge.begin(); // Initialize the Bridge
Serial.begin(9600); // Initialize the Serial
// Wait until a Serial Monitor is connected.
while(!Serial);
}

void loop()
{
int value = 0;

Process p;
p.runShellCommand("curl "Arduino Trial" + String(value) + "&pageHistory=0" -k");

int result = p.parseInt(); /* look for an integer /
Serial.print("Result:"); /
Some serial debugging */
Serial.println(result);
p.flush();

delay(20000); // Wait one second before get another temperature reading
}

Hi Raimon,

The Arduino IDE comes with an example of how to send data to a Google Spreadsheet via Temboo. You can find this under File -> Examples -> Bridge -> Temboo. You can also find it online here:

The example uses Serial to print data, so it assumes you're connected via USB. You can convert this to work wirelessly by replacing mentions of Serial with Console. Here's what you need to do to make that happen:

  1. Convert the setup() method to look like this:
void setup() {
  Bridge.begin();
  Console.begin(); 
  
  while(!Console);
}
  1. Replace each occurrence of "Serial" throughout the sketch with "Console" e.g., Serial.println("hello"); changes to Console.println("hello");

Hope that helps,
Cormac

P.S. I work at Temboo so feel free to get in touch with any questions.

Thanks Cormac!

That was useful. I managed to fix the code. I post it below in case someone is interested:

Raimon

#include <Process.h>

void setup()
{
Bridge.begin(); // Initialize the Bridge
}

void loop()
{
int value = 3;

Process p;
p.runShellCommand("curl "Arduino Trial" + String(value) + "&pageHistory=0" -k");
while(p.running());
delay(2000);

}

Hi there,

I know this was an old post, but I can not get this to work. Im trying to get my Arduino Yun to use the curl command to go to the URL to add the data to my goole docs spreadsheet via the form I made. Ive tested the form to make sure its working, but I cant not get my Yun to post to it. Am I missing something simple or very big? Please see my code.

Google_Doc_Spreadsheet.ino (2.25 KB)