Skip to content

Instantly share code, notes, and snippets.

@threeaccents
Created September 8, 2016 17:39
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 threeaccents/79af075db04226b07b62a94543129fd2 to your computer and use it in GitHub Desktop.
Save threeaccents/79af075db04226b07b62a94543129fd2 to your computer and use it in GitHub Desktop.
serialArd
#include <Servo.h>
Servo myservo;
void setup() {
Serial.begin(9600);
myservo.attach(9);
}
void loop() {
if(Serial.available() == 2){
char command = Serial.read();
int value = Serial.read();
if(command == 's') {
myservo.write(value);
}
if(command == 'l') {
// control lights
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment