Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kuatroestrellas/c0963a975d681fa4ceb1577840d79040 to your computer and use it in GitHub Desktop.
Save kuatroestrellas/c0963a975d681fa4ceb1577840d79040 to your computer and use it in GitHub Desktop.
alexa-esp8266
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudLight foco1;
CloudLight foco2;
Variables 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"
int luz1 = 12;
int luz2 = 13;
void setup() {
Serial.begin(9600);
pinMode(luz1, OUTPUT);
pinMode(luz2, OUTPUT);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
}
void onFoco1Change() {
if(foco1){
digitalWrite(luz1, HIGH);
}
else{
digitalWrite(luz1, LOW);
}
}
void onFoco2Change() {
if(foco2){
digitalWrite(luz2, HIGH);
}
else{
digitalWrite(luz2, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment