Skip to content

Instantly share code, notes, and snippets.

@ljahier
Created October 11, 2017 12:31
Show Gist options
  • Save ljahier/a5a4ae03af240b07a119c1af69638d14 to your computer and use it in GitHub Desktop.
Save ljahier/a5a4ae03af240b07a119c1af69638d14 to your computer and use it in GitHub Desktop.
int buttonPin1 = 8;
int buttonPin2 = 13;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
digitalWrite(buttonPin1, 1);
digitalWrite(buttonPin2, 1);
}
void loop() {
// put your main code here, to run repeatedly:
int button8 = digitalRead(buttonPin1);
int button13 = digitalRead(buttonPin2);
if (button8 == 0) {
Serial.write(1);
Serial.flush();
delay(20);
}
if (button13 == 0) {
Serial.write(2);
Serial.flush();
delay(20);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment