Serial Monitor Stops Updating Data

Hello

I am having trouble with my Serial Monitor, it seems to stop updating data. I try to run a simple sketch (as seen below) to see the values change when i press and release a button, however once I press the button the monitor stops updating.

int buttonPin = 2;
int buttonState = 0;

void setup () {
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}

void loop() {
buttonState = digitalRead(buttonPin);

Serial.println(buttonState);
}

This should be a very easy and straight forward sketch that displays either a 1 or a 0 in the monitor depending on if the button is pressed or not. When I upload the sketch and open the monitor I can clearly see the zeros updating (because the button is not pushed) but as soon I press the button the monitor stops updating and I cant even see the 1 that should appear.

Is Autoscroll checked?
Are you switching to GND with a Pull-up resistor to +5?

You probably have the button connected to adjacent pin 1 or pin 0 instead of pin 2. That would interfere with serial comms.

Did you start counting pins from 0 or 1, when you connected it? :slight_smile:

I think you are sending stuff much too quickly. loop() will repeat hundreds or thousands of times per second.

Add delay(500); after Serial.println()

...R