41 lines
1 KiB
Arduino
41 lines
1 KiB
Arduino
|
#include "thingProperties.h"
|
|||
|
|
|||
|
unsigned long previousMillis = 0;
|
|||
|
const long interval = 180000; //180 second interval (3 minutes)
|
|||
|
|
|||
|
void setup() {
|
|||
|
// Initialize serial and wait for port to open:
|
|||
|
Serial.begin(9600);
|
|||
|
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
|
|||
|
delay(1500);
|
|||
|
|
|||
|
// Defined in thingProperties.h
|
|||
|
initProperties();
|
|||
|
|
|||
|
// Connect to Arduino Cloud
|
|||
|
ArduinoCloud.begin(ArduinoIoTPreferredConnection, false);
|
|||
|
|
|||
|
/*
|
|||
|
The following function allows you to obtain more information
|
|||
|
related to the state of network and Arduino Cloud connection and errors
|
|||
|
the higher number the more granular information you’ll get.
|
|||
|
The default is 0 (only errors).
|
|||
|
Maximum is 4
|
|||
|
*/
|
|||
|
setDebugMessageLevel(2);
|
|||
|
ArduinoCloud.printDebugInfo();
|
|||
|
}
|
|||
|
|
|||
|
void loop() {
|
|||
|
ArduinoCloud.update();
|
|||
|
|
|||
|
unsigned long currentMillis = millis();
|
|||
|
|
|||
|
if (currentMillis - previousMillis >= interval) {
|
|||
|
|
|||
|
previousMillis = currentMillis;
|
|||
|
|
|||
|
test +=1;
|
|||
|
|
|||
|
}
|
|||
|
}
|