mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -5,14 +5,14 @@
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
Since this sketch uses a Google spreadsheet, you'll also need a
|
||||
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
|
||||
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
|
||||
@ -21,14 +21,14 @@
|
||||
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.
|
||||
In other words, your spreadsheet should look like:
|
||||
|
||||
Time | Sensor Value |
|
||||
|
||||
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 to use with your Arduino Yun? We've got over 100 in our Library!
|
||||
|
||||
This example code is in the public domain.
|
||||
@ -38,7 +38,7 @@
|
||||
#include <Bridge.h>
|
||||
#include <Temboo.h>
|
||||
#include "TembooAccount.h" // contains Temboo account information,
|
||||
// as described in the footer comment below
|
||||
// as described in the footer comment below
|
||||
|
||||
|
||||
/*** SUBSTITUTE YOUR VALUES BELOW: ***/
|
||||
@ -57,17 +57,17 @@ const String SPREADSHEET_TITLE = "your-spreadsheet-title";
|
||||
|
||||
const unsigned long RUN_INTERVAL_MILLIS = 60000; // how often to run the Choreo (in milliseconds)
|
||||
|
||||
// the last time we ran the Choreo
|
||||
// the last time we ran the Choreo
|
||||
// (initialized to 60 seconds ago so the
|
||||
// Choreo is run immediately when we start up)
|
||||
unsigned long lastRun = (unsigned long)-60000;
|
||||
unsigned long lastRun = (unsigned long) - 60000;
|
||||
|
||||
void setup() {
|
||||
|
||||
|
||||
// for debugging, wait until a serial console is connected
|
||||
Serial.begin(9600);
|
||||
delay(4000);
|
||||
while(!Serial);
|
||||
while (!Serial);
|
||||
|
||||
Serial.print("Initializing the bridge...");
|
||||
Bridge.begin();
|
||||
@ -84,7 +84,7 @@ void loop()
|
||||
|
||||
// remember 'now' as the last time we ran the choreo
|
||||
lastRun = now;
|
||||
|
||||
|
||||
Serial.println("Getting sensor value...");
|
||||
|
||||
// get the value we want to append to our spreadsheet
|
||||
@ -99,19 +99,19 @@ void loop()
|
||||
// NOTE that the client must be reinvoked and repopulated with
|
||||
// appropriate arguments each time its run() method is called.
|
||||
AppendRowChoreo.begin();
|
||||
|
||||
|
||||
// set Temboo account credentials
|
||||
AppendRowChoreo.setAccountName(TEMBOO_ACCOUNT);
|
||||
AppendRowChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
|
||||
AppendRowChoreo.setAppKey(TEMBOO_APP_KEY);
|
||||
|
||||
|
||||
// identify the Temboo Library choreo to run (Google > Spreadsheets > AppendRow)
|
||||
AppendRowChoreo.setChoreo("/Library/Google/Spreadsheets/AppendRow");
|
||||
|
||||
|
||||
// set the required Choreo inputs
|
||||
// see https://www.temboo.com/library/Library/Google/Spreadsheets/AppendRow/
|
||||
// see https://www.temboo.com/library/Library/Google/Spreadsheets/AppendRow/
|
||||
// for complete details about the inputs for this Choreo
|
||||
|
||||
|
||||
// your Google username (usually your email address)
|
||||
AppendRowChoreo.addInput("Username", GOOGLE_USERNAME);
|
||||
|
||||
@ -131,7 +131,7 @@ void loop()
|
||||
AppendRowChoreo.addInput("RowData", rowData);
|
||||
|
||||
// run the Choreo and wait for the results
|
||||
// The return code (returnCode) will indicate success or failure
|
||||
// The return code (returnCode) will indicate success or failure
|
||||
unsigned int returnCode = AppendRowChoreo.run();
|
||||
|
||||
// return code of zero (0) means success
|
||||
@ -139,7 +139,7 @@ void loop()
|
||||
Serial.println("Success! Appended " + rowData);
|
||||
Serial.println("");
|
||||
} else {
|
||||
// return code of anything other than zero means failure
|
||||
// return code of anything other than zero means failure
|
||||
// read and display any error messages
|
||||
while (AppendRowChoreo.available()) {
|
||||
char c = AppendRowChoreo.read();
|
||||
@ -151,7 +151,7 @@ void loop()
|
||||
}
|
||||
}
|
||||
|
||||
// this function simulates reading the value of a sensor
|
||||
// this function simulates reading the value of a sensor
|
||||
unsigned long getSensorValue() {
|
||||
return analogRead(A0);
|
||||
}
|
||||
@ -164,15 +164,15 @@ unsigned long getSensorValue() {
|
||||
by inserting your own Temboo account name and app key information. The contents of the file should
|
||||
look like:
|
||||
|
||||
#define TEMBOO_ACCOUNT "myTembooAccountName" // your Temboo account name
|
||||
#define TEMBOO_ACCOUNT "myTembooAccountName" // your Temboo account name
|
||||
#define TEMBOO_APP_KEY_NAME "myFirstApp" // your Temboo app key name
|
||||
#define TEMBOO_APP_KEY "xxx-xxx-xxx-xx-xxx" // your Temboo app key
|
||||
|
||||
You can find your Temboo App Key information on the Temboo website,
|
||||
You can find your Temboo App Key information on the Temboo website,
|
||||
under My Account > Application Keys
|
||||
|
||||
The same TembooAccount.h file settings can be used for all Temboo SDK sketches.
|
||||
|
||||
Keeping your account information in a separate file means you can share the main .ino file without worrying
|
||||
Keeping your account information in a separate file means you can share the main .ino file without worrying
|
||||
that you forgot to delete your credentials.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user