diff options
author | Tom Igoe <tom.igoe@gmail.com> | 2013-05-27 13:12:05 -0400 |
---|---|---|
committer | Tom Igoe <tom.igoe@gmail.com> | 2013-05-27 13:12:05 -0400 |
commit | 7fdc81d145c7717aaa6b48952b46542971844086 (patch) | |
tree | abf2961775857f625b0329207b1cbe8701732cce /libraries/Bridge/examples | |
parent | 21019b0a41c3e8f13d34d319774f4efa2fc14eda (diff) |
Updates to Xively client
Diffstat (limited to 'libraries/Bridge/examples')
-rw-r--r-- | libraries/Bridge/examples/XivelyClient/XivelyClient.ino | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libraries/Bridge/examples/XivelyClient/XivelyClient.ino b/libraries/Bridge/examples/XivelyClient/XivelyClient.ino index 1286230..be04d40 100644 --- a/libraries/Bridge/examples/XivelyClient/XivelyClient.ino +++ b/libraries/Bridge/examples/XivelyClient/XivelyClient.ino @@ -35,6 +35,7 @@ // set up net client info: boolean lastConnected = false; // state of the connection last time through the main loop const unsigned long postingInterval = 60000; //delay between updates to Pachube.com +unsigned long lastRequest = 0; // when you last made a request String dataString = ""; Process xively; @@ -43,7 +44,10 @@ void setup() { Serial.begin(9600); Bridge.begin(); delay(2000); - + + while(!Serial); // wait for Serial Monitor to open + Serial.println("Xively client"); + // reserve space for dataString: dataString.reserve(100); } @@ -70,8 +74,9 @@ void loop() { // if you're not connected, and the sending interval has passed since // your last connection, then connect again and send data: - if(now % postingInterval < 5) { + if(now - lastRequest >= postingInterval) { sendData(); + lastRequest = now; } } |