void setup() {
initProperties();
ArduinoCloud.begin(conMan);
setDebugMessageLevel(4);
ArduinoCloud.printDebugInfo();
//conMan is the connection manager called in thing prop
conMan.addCallback(NetworkConnectionEvent::CONNECTED, onNetworkConnect);
conMan.addCallback(NetworkConnectionEvent::DISCONNECTED, onNetworkDisconnect);
conMan.addCallback(NetworkConnectionEvent::ERROR, onNetworkError);
//setup pinmode display etc know to work code cut out
}
void loop() {
serialtoarray(); //gets my data loops always
ButtonCheck();
menuinteraktion();
u8g2.firstPage();
do {
drawMenu();
} while ( u8g2.nextPage() );
conMan.check();
ArduinoCloud.update();
}
this is the main.cpp setup
in the thingProperies.h only
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
//Thin ID and SSID etc
void onInnOTChange();
String innOT;
void initProperties(){
ArduinoCloud.setThingId(THING_ID);
ArduinoCloud.addProperty(innOT, READWRITE, ON_CHANGE, onInnOTChange);
}
WiFiConnectionHandler conMan(SSID, PASS);
//what to do if connection is lst etc
void onNetworkConnect() {
Serial.println(">>>> CONNECTED to network");
}
void onNetworkDisconnect() {
Serial.println(">>>> DISCONNECTED from network");
}
void onNetworkError() {
Serial.println(">>>> ERROR");
}
...