I'm fairly new to using arduino and im trying to make a basic trivia game... but whenever i click one button the serial.println for both shows up!! I had the same problem with using LEDS when i clicked either button both LEDS turned on. How would i go about fixing this?
Here's my code so far...
int buttonstate;
int buttonstateR;
void setup() {
Serial.begin(9600);
pinMode(13, INPUT);
pinMode(12, INPUT);
}
void loop() {
buttonstate = digitalRead(13);
buttonstateR = digitalRead(12);
if(buttonstate == LOW){
Serial.println("a");
}
else
{
Serial.end();
}
if(buttonstateR == LOW){
Serial.println("b");
}
else
{
Serial.end();
}
}
