Created
September 30, 2021 00:43
-
-
Save k-kawaa/6944422c57d8006b5d0c9e63d013f940 to your computer and use it in GitHub Desktop.
Arduino button sample
This file contains 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
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