Button doesnt work.


I’m begginer with arduino.Today i got it and i have a problem with button.When i plug it in it keeps being on a LOW mode and even when I click it nothing is working.I tried with diffrent codes and schemes


void setup(){

pinMode(11, OUTPUT);
pinMode(2, INPUT_PULLUP);
digitalWrite(11, LOW);

void loop() {
if (digitalRead(2) == LOW) {
digitalWrite(11, HIGH);
} else {
digitalWrite(11, LOW);


The lighting and photo of your uploaded photo does not make it clear where your wires are connected.

I recommend using an ohm meter and explore the pins on that switch to see which of the pins on the switch cause current to flow when the button is pressed. If your button has 4 legs, you need to figure out which 2 legs to use.


Remount the button 90 degrees. You have made your connections on the same switch contact. Each of the two contacts have two legs attached. An easy way to avoid this is to place the switch across the gap on your board and make connections to diagonal pins.


Next time you buy parts, purchase some SMD switches and solder them to headers.

Then throw those square switches in the garbage.


Also, where is the ground?

It appears he is using the red jumper to supply ground to the proto board. ( Had to enlarge the picture to determine the connections to the Uno)