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);
}
How are your buttons wired? Do you have pull-up or pull-down resistors? Normally one would use the built-in pull-ups to avoid needing external resistors.
Serial.end();
Are you sure you really want to call that? What do YOU think it does?
avparker:
I have pull-down resistors.. how would i use the built in pull-up? And lol! I'll definitely remove serial.end, thanks!
If you're using pull-down configuration then those buttons should read LOW when they are NOT pressed. SO it should spam 'a' and 'b' to the serial monitor until you press a button and shut down the serial link.