Button 12 Button on Zumo shield not working?

I’m pretty sure I soldered it correctly. I tested it with a multimeter and the resistance drops on button press.

So after that, I tried a program using it that just turns on the LED when pressed, akin to the basic button LED from other beginner projects.

But nothing happens when pressed.

[code]// ZumoTesting.ino

#include <ZumoMotors.h>

#define LED_PIN 13
#define BUTTON_PIN 12

ZumoMotors motors;

int buttonState = 0;

void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT);

Serial.begin(9600);

}

void loop() {
// read the pushbutton input pin:
buttonState = digitalRead(BUTTON_PIN);

if(buttonState == LOW){
digitalWrite(LED_PIN, HIGH);
} else {
digitalWrite(LED_PIN, LOW);
}

}

[/code]

I used buttonState == LOW because the documentation says, pressing pulls LOW.

Hello.

Thank you for posting your code. It looks like pin 12 is currently a floating input in your code when the button is not pressed and (since the button is pulled down on one side) pulled low when it is pressed. For it to read high, you will need to declare it’s pinMode() as INPUT_PULLUP. After doing this, pin 12 should read high when the button is not pressed and low when it is. Could you try making that change to see if it fixes the problem?

Also, you might find our Pushbutton library helpful. It is included in our Zumo Shield Arduino Libraries and has functions that you might find useful for detecting and debouncing pushbutton presses.

-Brandon