Created
December 10, 2013 20:04
-
-
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
This file contains hidden or 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
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