1+ #include <ArduinoIoTCloud.h>
2+
3+ #include "arduino_secrets.h"
4+
15#if !(defined(BOARD_HAS_WIFI ) || defined(BOARD_HAS_GSM ) || defined(BOARD_HAS_LORA ) || \
26 defined(BOARD_HAS_NB ) || defined(BOARD_HAS_ETHERNET ) || defined(BOARD_HAS_CATM1_NBIOT ))
37 #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
@@ -20,13 +24,13 @@ void initProperties() {
2024 ArduinoCloud .setSecretDeviceKey (SECRET_DEVICE_KEY );
2125#endif
2226#if defined(BOARD_HAS_WIFI ) || defined(BOARD_HAS_GSM ) || defined(BOARD_HAS_NB ) || defined(BOARD_HAS_ETHERNET ) || defined(BOARD_HAS_CATM1_NBIOT )
23- ArduinoCloud .addProperty (switchButton , WRITE , ON_CHANGE , onSwitchButtonChange );
24- ArduinoCloud .addProperty (location , READ , ON_CHANGE );
25- ArduinoCloud .addProperty (color , READWRITE , ON_CHANGE , onColorChange );
27+ ArduinoCloud .addProperty (switchButton , Permission :: Write ). onUpdate ( onSwitchButtonChange );
28+ ArduinoCloud .addProperty (location , Permission :: Read ). publishOnChange ( 0.0f );
29+ ArduinoCloud .addProperty (color , Permission :: ReadWrite ). onUpdate ( onColorChange );
2630#elif defined(BOARD_HAS_LORA )
27- ArduinoCloud .addProperty (switchButton , 1 , WRITE , ON_CHANGE , onSwitchButtonChange );
28- ArduinoCloud .addProperty (location , 2 , READ , ON_CHANGE );
29- ArduinoCloud .addProperty (color , 3 , READWRITE , ON_CHANGE , onColorChange );
31+ ArduinoCloud .addProperty (switchButton , 1 , Permission :: Write ). onUpdate ( onSwitchButtonChange );
32+ ArduinoCloud .addProperty (location , 2 , Permission :: Read ). publishOnChange ( 0.0f );
33+ ArduinoCloud .addProperty (color , 3 , Permission :: ReadWrite ). onUpdate ( onColorChange );
3034#endif
3135}
3236
0 commit comments