Created
February 12, 2017 14:37
-
-
Save gittimos/f7f4114f4c0ed7d5ee8a2f4196d40acf to your computer and use it in GitHub Desktop.
Publish Particle functions
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
// Cloud functions must return int and take one String | |
// see https://docs.particle.io/reference/firmware/photon/#particle-function- | |
int switchOn(String s); | |
int switchOff(String s); | |
int led = D7; | |
void setup() { | |
pinMode(led, OUTPUT); | |
Particle.function("switchOn", switchOn); | |
Particle.function("switchOff", switchOff); | |
} | |
void loop() { | |
} | |
int switchOn(String s) { | |
digitalWrite(led, HIGH); | |
return 1; | |
} | |
int switchOff(String s) { | |
digitalWrite(led, LOW); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment