I am trying to get a simple button as digital input on my Arduino Micro. Here is my code, using the internal pullup resistor. I have checked that the voltage across the button is working, but am not seeing any reaction in my serial monitor. Any advice?
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 7; // the number of the pushbutton pin
// variables will change:
int buttonState = 1; // variable for reading the pushbutton status
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
Serial.println(buttonState);
}