From 9bc2ad10cb38ca5c659abb41f03b169928c70792 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Fri, 28 Jun 2013 11:08:56 +0200 Subject: updated and added new Temboo examples --- .../SendDataToGoogleSpreadsheet.ino | 51 +++++++++++++++------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet') diff --git a/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino b/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino index 984bd53..9698d81 100644 --- a/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino +++ b/libraries/Bridge/examples/Temboo/SendDataToGoogleSpreadsheet/SendDataToGoogleSpreadsheet.ino @@ -1,26 +1,37 @@ /* SendDataToGoogleSpreadsheet - Demonstrates appending a row of data to a Google spreadsheet - from the Arduino Yun using the Temboo Arduino Yun SDK. + Demonstrates appending a row of data to a Google spreadsheet from the Arduino Yun + using the Temboo Arduino Yun SDK. + + Check out the latest Arduino & Temboo examples and support docs at http://www.temboo.com/arduino A Temboo account and application key are necessary to run all Temboo examples. If you don't already have one, you can register for a free Temboo account at http://www.temboo.com - This example assumes basic familiarity with Arduino sketches, and that your - Yun is connected to the Internet. For more tutorials on using the Temboo Library - and Temboo Arduino Yun SDK, visit http://www.temboo.com/arduino - Since this sketch uses a Google spreadsheet, you'll also need a Google account: substitute the placeholders below for your Google account values. + This example assumes basic familiarity with Arduino sketches, and that your + Yun is connected to the Internet. + The columns in your spreadsheet must have labels for the Choreo to work properly. It doesn't matter what the column labels actually are, but there must be text in the first row of each column. This example assumes there are two columns. The first column is the time (in milliseconds) that the row was appended, and the second column is a sensor value - (simulated in this example via a random number). + (simulated in this example via a random number). In other words, your spreadsheet + should look like: + + Time | Sensor Value | + ------+----------------- + | | + + NOTE that the first time you run this sketch, you may receive a warning from + Google, prompting you to authorize access from a 3rd party system. + + Looking for another API? We've got over 100 in our Library! This example code is in the public domain. @@ -31,7 +42,17 @@ #include #include #include -#include "TembooAccount.h" // contains Temboo account information, as described below +#include "TembooAccount.h" // contains Temboo account information, + // as described in the footer comment below + + +/*** SUBSTITUTE YOUR VALUES BELOW: ***/ + +const String GOOGLE_USERNAME = "your-google-username"; +const String GOOGLE_PASSWORD = "your-google-password"; + +// the title of the spreadsheet you want to send data to +const String SPREADSHEET_TITLE = "your-spreadsheet-title"; const unsigned long RUN_INTERVAL_MILLIS = 60000; // how often to run the Choreo (in milliseconds) @@ -94,19 +115,17 @@ void loop() // for complete details about the inputs for this Choreo // your Google username (usually your email address) - // NOTE: substitute your own value, retaining the "Username:" prefix. AppendRowChoreo.addParameter("-i"); - AppendRowChoreo.addParameter("Username:your-google-username"); + AppendRowChoreo.addParameter("Username:" + GOOGLE_USERNAME); // your Google account password - // NOTE: substitute your own value, retaining the "Password:" prefix. AppendRowChoreo.addParameter("-i"); - AppendRowChoreo.addParameter("Password:your-google-password"); + AppendRowChoreo.addParameter("Password:" + GOOGLE_PASSWORD); // the title of the spreadsheet you want to append to // NOTE: substitute your own value, retaining the "SpreadsheetTitle:" prefix. AppendRowChoreo.addParameter("-i"); - AppendRowChoreo.addParameter("SpreadsheetTitle:your-spreadsheet-title"); + AppendRowChoreo.addParameter("SpreadsheetTitle:" + SPREADSHEET_TITLE); // convert the time and sensor values to a comma separated string String rowData(now); @@ -124,6 +143,7 @@ void loop() // return code of zero (0) means success if (rc == 0) { Serial.println("Success! Appended " + rowData); + Serial.println(""); } else { // return code of anything other than zero means failure // read and display any error messages @@ -155,11 +175,10 @@ unsigned long getSensorValue() { The same TembooAccount.h file settings can be used for all Temboo SDK sketches. - Visit https://www.temboo.com/account to access your Temboo account credentials. + You can find your Temboo App Key information on the Temboo website, + under My Account > Application Keys Keeping your account information in a separate file means you can save it once, then just distribute the main .ino file without worrying that you forgot to delete your credentials. - - (Be sure to delete this comment after creating your TembooAccount.h file!) */ -- cgit v1.2.3-18-g5258