Skip to content

Instantly share code, notes, and snippets.

@techninja
Created December 10, 2013 20:04
Show Gist options
  • Save techninja/7897262 to your computer and use it in GitHub Desktop.
Save techninja/7897262 to your computer and use it in GitHub Desktop.
Quick and tiny Spark board Arduino code for @makersylvia's AR drone hack at RobotsConf 2013
Servo myservo;
void setup()
{
myservo.attach(D0); // attaches the servo on pin 0 of the Spark board
Spark.function("claw", claw); // Spark API function registration
}
void loop()
{
}
int claw(String toggle) {
if (toggle == "open") {
myservo.write(150);
} else if(toggle == "close") {
myservo.write(0);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment