Skip to content

Instantly share code, notes, and snippets.

@nilsonpessim
Last active August 29, 2015 14:01
Show Gist options
  • Save nilsonpessim/f93af3499e62ce0a8056 to your computer and use it in GitHub Desktop.
Save nilsonpessim/f93af3499e62ce0a8056 to your computer and use it in GitHub Desktop.
#include <Servo.h>
Servo motor;
int serial;
void setup(){
Serial.begin(9600);
motor.attach(6);
}
void loop(){
if(Serial.available()){
serial = Serial.read();
if (serial == 'a') {
motor.write(0);
}
if (serial == 'b') {
motor.write(90);
}
if (serial == 'c') {
motor.write(180);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment