aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino')
-rw-r--r--libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino28
1 files changed, 17 insertions, 11 deletions
diff --git a/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino b/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
index 4a4e818..48c3b11 100644
--- a/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
+++ b/libraries/Bridge/examples/Temboo/GetYahooWeatherReport/GetYahooWeatherReport.ino
@@ -25,6 +25,10 @@
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
+
+// the address for which a weather forecast will be retrieved
+String ADDRESS_FOR_FORECAST = "104 Franklin St., New York NY 10013";
+
int numRuns = 0; // execution count, so that this doesn't run forever
int maxRuns = 10; // max number of times the Yahoo WeatherByAddress Choreo should be run
@@ -32,6 +36,7 @@ void setup() {
Serial.begin(9600);
// for debugging, wait until a serial console is connected
+ delay(4000);
while(!Serial);
Bridge.begin();
}
@@ -58,14 +63,14 @@ void loop()
GetWeatherByAddressChoreo.addParameter("-p");
GetWeatherByAddressChoreo.addParameter(TEMBOO_APP_KEY);
- // identify the Temboo Library choreo to run (Yahoo > Weather > GetWeatherByAddress)
+ // identify the Temboo Library choreo to run (Yahoo > Weather > GetWeatherByAddress)
GetWeatherByAddressChoreo.addParameter("-c");
GetWeatherByAddressChoreo.addParameter("/Library/Yahoo/Weather/GetWeatherByAddress");
// set choreo inputs; in this case, the address for which to retrieve weather data
// the Temboo client provides standardized calls to 100+ cloud APIs
GetWeatherByAddressChoreo.addParameter("-i");
- GetWeatherByAddressChoreo.addParameter("Address:104 Franklin St., New York NY 10013");
+ GetWeatherByAddressChoreo.addParameter("Address:" + ADDRESS_FOR_FORECAST);
// run the choreo
GetWeatherByAddressChoreo.run();
@@ -76,34 +81,35 @@ void loop()
// note that in this example, we just print the raw XML response from Yahoo
// see the examples on using Temboo SDK output filters at http://www.temboo.com/arduino
// for information on how to filter this data
-
- Serial.print((char)GetWeatherByAddressChoreo.read());
+ char c = GetWeatherByAddressChoreo.read();
+ Serial.print(c);
}
GetWeatherByAddressChoreo.close();
}
- Serial.println("Sleeping...");
+ Serial.println("Waiting...");
Serial.println("");
- delay(30000); // sleep 30 seconds between GetWeatherByAddress calls
+ delay(30000); // wait 30 seconds between GetWeatherByAddress calls
}
/*
IMPORTANT NOTE: TembooAccount.h:
- TembooAccount.h is a file referenced by this sketch that contains your Temboo account information.
- You need to create this file. To do so, make a new tab in Arduino, call it TembooAccount.h, and
- include the following variables and constants:
+ TembooAccount.h is a file referenced by this sketch that contains your Temboo account information.
+ You'll need to edit the placeholder version of TembooAccount.h included with this example sketch,
+ 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_APP_KEY_NAME "myFirstApp" // your Temboo app key name
#define TEMBOO_APP_KEY "xxx-xxx-xxx-xx-xxx" // your Temboo app key
- The same TembooAccount.h file settings can be used for all Temboo SDK sketches.
-
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 save it once,
then just distribute the main .ino file without worrying that you forgot to delete your credentials.
*/