Skip to content

Instantly share code, notes, and snippets.

@greymd
Last active August 19, 2016 15:02
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 greymd/78a4c6dbf35611e84220 to your computer and use it in GitHub Desktop.
Save greymd/78a4c6dbf35611e84220 to your computer and use it in GitHub Desktop.
int VIB = 2;
int state = LOW;
void setup(){
Serial.begin(9600);
pinMode(VIB,OUTPUT);
}
void loop(){
if (Serial.available()) {
char c = Serial.read();
if (c == '1') {
state = HIGH;
} else if (c == '0') {
state = LOW;
}
}
digitalWrite(VIB, state);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment