Hi, I have connected an Arduino Opla Kit to the cloud and generated automatically the code below. The code is saved in the file thingsProperties.h.
The sketch file implements the header functions defined in thingsProperties.h.
For example:
void onMovementAlarmChange() {
// Do something
if (movement_alarm == true) {
movement_alarm_state = "MOVEMENT ALARM: ON";
delay(500);
movement_alarm = false;
} else {
movement_alarm_state = "MOVEMENT ALARM: OFF";
}
updateScreen();
}
My question is, without using the automatically generated code by the Arduino cloud, how would I know what header functions would be available?
I assume that these are dependant on the board. I see the following
void onMessageUpdateChange();
void onLightAlarmChange();
void onLightEventChange();
void onMovementAlarmChange();
void onMovementEventChange();
void onShakeAlarmChange();
void onShakeEventChange();
I also wonder if there are other functions or if Arduino cloud automatically generates them based on the board one connects.
If so where are these defined?
Here is the code of the thingsProperties.h file (automatically generated):
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char SSID[] = SECRET_SSID; // Network SSID (name)
const char PASS[] = SECRET_OPTIONAL_PASS; // Network password (use for WPA, or use as key for WEP)
void onMessageUpdateChange();
void onLightAlarmChange();
void onLightEventChange();
void onMovementAlarmChange();
void onMovementEventChange();
void onShakeAlarmChange();
void onShakeEventChange();
String message_update;
bool light_alarm;
bool light_event;
bool movement_alarm;
bool movement_event;
bool shake_alarm;
bool shake_event;
void initProperties(){
ArduinoCloud.addProperty(message_update, READWRITE, ON_CHANGE, onMessageUpdateChange);
ArduinoCloud.addProperty(light_alarm, READWRITE, ON_CHANGE, onLightAlarmChange);
ArduinoCloud.addProperty(light_event, READWRITE, ON_CHANGE, onLightEventChange);
ArduinoCloud.addProperty(movement_alarm, READWRITE, ON_CHANGE, onMovementAlarmChange);
ArduinoCloud.addProperty(movement_event, READWRITE, ON_CHANGE, onMovementEventChange);
ArduinoCloud.addProperty(shake_alarm, READWRITE, ON_CHANGE, onShakeAlarmChange);
ArduinoCloud.addProperty(shake_event, READWRITE, ON_CHANGE, onShakeEventChange);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);