Skip to content

Instantly share code, notes, and snippets.

@k-kawaa
Created September 30, 2021 00:43
Show Gist options
  • Save k-kawaa/6944422c57d8006b5d0c9e63d013f940 to your computer and use it in GitHub Desktop.
Save k-kawaa/6944422c57d8006b5d0c9e63d013f940 to your computer and use it in GitHub Desktop.
Arduino button sample
int buttonA = 8;
int buttonB = 9;
int buttonEB = 7;
int speed = 9600;
void setup()
{
Serial.begin(speed);
pinMode(buttonA,INPUT_PULLUP);
pinMode(buttonB,INPUT_PULLUP);
pinMode(buttonEB,INPUT_PULLUP);
}
void loop()
{
if(digitalRead(buttonA) == LOW){
Serial.write("AKE\n");
}
if(digitalRead(buttonB) == LOW){
Serial.write("SHIME\n");
}
if(digitalRead(buttonEB) == LOW){
Serial.write("EB\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment