|
3 | 3 |
|
4 | 4 | Demonstrates appending a row of data to a Google spreadsheet using Temboo from an Arduino Yún.
|
5 | 5 |
|
6 |
| - Check out the latest Arduino & Temboo examples and support docs at http://www.temboo.com/arduino |
| 6 | + Check out the latest Arduino & Temboo examples and tutorials at http://www.temboo.com/arduino |
7 | 7 |
|
8 | 8 | A Temboo account and application key are necessary to run all Temboo examples.
|
9 | 9 | If you don't already have one, you can register for a free Temboo account at
|
10 | 10 | http://www.temboo.com
|
11 | 11 |
|
12 |
| - Since this sketch uses a Google spreadsheet, you'll also need a |
13 |
| - Google account: substitute the placeholders below for your Google account values. |
14 |
| -
|
15 |
| - This example assumes basic familiarity with Arduino sketches, and that your |
16 |
| - Yún is connected to the Internet. |
17 |
| -
|
18 |
| - The columns in your spreadsheet must have labels for the Choreo to |
19 |
| - work properly. It doesn't matter what the column labels actually are, |
20 |
| - but there must be text in the first row of each column. This example |
21 |
| - assumes there are two columns. The first column is the time (in milliseconds) |
22 |
| - that the row was appended, and the second column is a sensor value. |
23 |
| - In other words, your spreadsheet should look like: |
| 12 | + Instructions: |
| 13 | + |
| 14 | + 1. Create a Temboo account: http://www.temboo.com |
| 15 | + |
| 16 | + 2. Retrieve your Temboo application details: http://www.temboo.com/account/applications |
| 17 | + |
| 18 | + 3. Replace the values in the TembooAccount.h tab with your Temboo application details |
24 | 19 |
|
25 |
| - Time | Sensor Value | |
26 |
| - ------+----------------- |
27 |
| - | | |
| 20 | + 4. You'll also need a Google Spreadsheet that includes a title in the first row |
| 21 | + of each column that data will be written to. This example assumes there are two columns. |
| 22 | + The first column is the time (in milliseconds) that the row was appended, and the second |
| 23 | + column is a sensor value. In other words, your spreadsheet should look like: |
28 | 24 |
|
29 |
| - NOTE that the first time you run this sketch, you may receive a warning from |
30 |
| - Google, prompting you to authorize access from a 3rd party system. |
| 25 | + Time | Sensor Value | |
| 26 | + ------+----------------- |
| 27 | + | | |
| 28 | + |
| 29 | + 5. Google Spreadsheets requires you to authenticate via OAuth. Follow the steps |
| 30 | + in the link below to find your ClientID, ClientSecret, and RefreshToken, and then |
| 31 | + use those values to overwrite the placeholders in the code below. |
| 32 | + |
| 33 | + https://temboo.com/library/Library/Google/OAuth/ |
| 34 | + |
| 35 | + For the scope field, you need to use: https://spreadsheets.google.com/feeds/ |
| 36 | + |
| 37 | + Here's a video outlines how Temboo helps with the OAuth process: |
| 38 | + |
| 39 | + https://www.temboo.com/videos#oauthchoreos |
| 40 | + |
| 41 | + And here's a more in-depth version of this example on our website: |
| 42 | + |
| 43 | + https://temboo.com/arduino/yun/update-google-spreadsheet |
| 44 | + |
| 45 | + 6. Next, upload the sketch to your Arduino Yún and open the serial monitor |
| 46 | + |
| 47 | + Note: you can test this Choreo and find the latest instructions on our website: |
| 48 | + https://temboo.com/library/Library/Google/Spreadsheets/AppendRow/ |
31 | 49 |
|
32 | 50 | Looking for another API to use with your Arduino Yún? We've got over 100 in our Library!
|
33 | 51 |
|
|
46 | 64 | // Note that for additional security and reusability, you could
|
47 | 65 | // use #define statements to specify these values in a .h file.
|
48 | 66 |
|
49 |
| -const String GOOGLE_USERNAME = "your-google-username"; |
50 |
| -const String GOOGLE_PASSWORD = "your-google-password"; |
| 67 | +// the clientID found in Google's Developer Console under APIs & Auth > Credentials |
| 68 | +const String CLIENT_ID = "your-client-id"; |
| 69 | + |
| 70 | +// the clientSecret found in Google's Developer Console under APIs & Auth > Credentials |
| 71 | +const String CLIENT_SECRET = "your-client-secret"; |
| 72 | + |
| 73 | +// returned after running FinalizeOAuth |
| 74 | +const String REFRESH_TOKEN = "your-oauth-refresh-token"; |
51 | 75 |
|
52 | 76 | // the title of the spreadsheet you want to send data to
|
53 | 77 | // (Note that this must actually be the title of a Google spreadsheet
|
@@ -112,11 +136,12 @@ void loop()
|
112 | 136 | // see https://www.temboo.com/library/Library/Google/Spreadsheets/AppendRow/
|
113 | 137 | // for complete details about the inputs for this Choreo
|
114 | 138 |
|
115 |
| - // your Google username (usually your email address) |
116 |
| - AppendRowChoreo.addInput("Username", GOOGLE_USERNAME); |
117 |
| - |
118 |
| - // your Google account password |
119 |
| - AppendRowChoreo.addInput("Password", GOOGLE_PASSWORD); |
| 139 | + // your Google application client ID |
| 140 | + AppendRowChoreo.addInput("ClientID", CLIENT_ID); |
| 141 | + // your Google application client secert |
| 142 | + AppendRowChoreo.addInput("ClientSecret", CLIENT_SECRET); |
| 143 | + // your Google OAuth refresh token |
| 144 | + AppendRowChoreo.addInput("RefreshToken", REFRESH_TOKEN); |
120 | 145 |
|
121 | 146 | // the title of the spreadsheet you want to append to
|
122 | 147 | // NOTE: substitute your own value, retaining the "SpreadsheetTitle:" prefix.
|
|
0 commit comments