Last active
July 9, 2018 17:58
-
-
Save 8q/253fdd04378b5a96ceaf43eba347866c to your computer and use it in GitHub Desktop.
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
#include <Servo.h> | |
#define SERVO_PIN 3 | |
Servo servo; | |
void setup() { | |
Serial.begin(9600); | |
servo.attach(SERVO_PIN); | |
servo.write(60); | |
} | |
void loop() { | |
if(Serial.available() > 0) { | |
char c = Serial.read(); | |
switch(c) { | |
case 'x': | |
servo.write(100); | |
Serial.println("off"); | |
delay(1000); | |
servo.write(60); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment