Skip to content

Instantly share code, notes, and snippets.

@julianshen
Created December 11, 2013 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianshen/7914805 to your computer and use it in GitHub Desktop.
Save julianshen/7914805 to your computer and use it in GitHub Desktop.
// 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