Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "arduino_secrets.h"
- #include "thingProperties.h"
- #include <Arduino_MKRENV.h>
- void setup() {
- Serial.begin(9600);
- delay(1500);
- initProperties();
- ArduinoCloud.begin(ArduinoIoTPreferredConnection);
- setDebugMessageLevel(2);
- ArduinoCloud.printDebugInfo();
- if (!ENV.begin()) {
- Serial.println("Failed to initialize MKR ENV shield!");
- while(1);
- }
- }
- void loop() {
- ArduinoCloud.update();
- humidity = int(ENV.readHumidity());
- illuminance = int(ENV.readIlluminance());
- pressure = int(ENV.readPressure());
- temperature = int(ENV.readTemperature());
- delay(1000);
- }
- void onHumidityChange() {
- // Do something if necessary
- }
- void onIlluminanceChange() {
- // Do something if necessary
- }
- void onPressureChange() {
- // Do something if necessary
- }
- void onTemperatureChange() {
- // Do something if necessary
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement