Update adafruitio_00_publish_modified.cpp time_stamp

beta-mqtt
Alan Johnston 2 years ago committed by GitHub
parent 200868b6fb
commit 8786c298ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -28,7 +28,7 @@
// this int will hold the current count for our sketch // this int will hold the current count for our sketch
int count = 0; int count = 0;
bool aio_connected = false; bool aio_connected = false;
unsigned long delay; unsigned long time_stamp;
// set up the 'counter' feed // set up the 'counter' feed
//AdafruitIO_Feed *counter = io.feed("counter"); //AdafruitIO_Feed *counter = io.feed("counter");
@ -60,7 +60,7 @@ void aio_setup() {
Serial.println(); Serial.println();
Serial.println(io.statusText()); Serial.println(io.statusText());
*/ */
delay = millis(); time_stamp = millis();
} }
void aio_loop(float tlm[]) { void aio_loop(float tlm[]) {
@ -81,8 +81,8 @@ void aio_loop(float tlm[]) {
// io.adafruit.com, and processes any incoming data. // io.adafruit.com, and processes any incoming data.
io.run(); io.run();
if ((millis() - delay) > 8000) { // Only send if 8 seconds have passed if ((millis() - time_stamp) > 8000) { // Only send if 8 seconds have passed
delay = millis(); time_stamp = millis();
// save count to the 'counter' feed on Adafruit IO // save count to the 'counter' feed on Adafruit IO
Serial.print("\nSending to Adafruit IO -> "); Serial.print("\nSending to Adafruit IO -> ");
// Serial.println(count); // Serial.println(count);

Loading…
Cancel
Save

Powered by TurnKey Linux.