Created
December 11, 2013 17:31
-
-
Save julianshen/7914805 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
// give it a name: | |
int _led = D7; | |
//function definition | |
int led(String command); | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize the digital pin as an output. | |
pinMode(_led, OUTPUT); | |
Spark.function("led", led); | |
} | |
// the loop routine runs over and over again forever: | |
int led(String command) { | |
if(command == "ON") { | |
digitalWrite(_led, HIGH); // turn the LED on (HIGH is the voltage level) | |
} else { | |
digitalWrite(_led, LOW); // turn the LED off | |
} | |
return 1; | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment