Created
June 1, 2016 15:22
-
-
Save patricksimpson/e070f842d50eb4fc51da6e6cb1d4b696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int led = D0; | |
void setup() { | |
// This part is mostly the same: | |
pinMode(led,OUTPUT); // Our LED pin is output (lighting up the LED) | |
Particle.subscribe("opendoor", myOpen); | |
Particle.subscribe("closedoor", myClose); | |
digitalWrite(led, HIGH); | |
delay(2500); | |
Particle.publish("Started"); | |
digitalWrite(led, LOW); | |
} | |
void loop() { | |
} | |
// Now for the myHandler function, which is called when the cloud tells us that our buddy's event is published. | |
void myOpen(const char *event, const char *data) | |
{ | |
digitalWrite(led, HIGH); | |
Particle.publish("Open door!"); | |
} | |
// Now for the myHandler function, which is called when the cloud tells us that our buddy's event is published. | |
void myClose(const char *event, const char *data) | |
{ | |
digitalWrite(led, LOW); | |
Particle.publish("Close door..."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment