Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
78 lines (61 sloc) 2.14 KB
#include "arduino_secrets.h"
/*
Sketch generated by the Arduino IoT Cloud Thing "Test_MultiValue"
https://create-dev.arduino.cc/cloud/things/06012290-ec85-4f5c-aa00-81c0525efa0c
Arduino IoT Cloud Properties description
The following variables are automatically generated and updated when changes are made to the Thing properties
bool switchButton;
Properties which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
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 IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT 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();
}
float latMov = 45.5058224, lonMov = 9.1628673;
float latArd = 45.0502078, lonArd = 7.6674765;
float hueRed = 0.0, satRed = 100.0, briRed = 100.0;
float hueGreen = 80.0, satGreen = 100.0, briGreen = 100.0;
void loop() {
ArduinoCloud.update();
// Your code here
switchButton = !switchButton;
if (switchButton) {
location = Location(latMov, lonMov);
color = Color(hueRed, satRed, briRed);
} else {
location = Location(latArd, lonArd);
color = Color(hueGreen, satGreen, briGreen);
}
delay(5000);
}
void onSwitchButtonChange() {
// Do something
digitalWrite(LED_BUILTIN, switchButton);
}
void onColorChange() {
// Do something
Serial.print("Hue = ");
Serial.println(color.getValue().hue);
Serial.print("Sat = ");
Serial.println(color.getValue().sat);
Serial.print("Bri = ");
Serial.println(color.getValue().bri);
}
You can’t perform that action at this time.