Beginner's question about button and LED

Hello Everyone :slight_smile:
I’m a beginner and I felt in love in Arduino.
I’m trying to create simple program that turns on LED when I pushed the button. But I’ve absolutely no idea why it doesn’t work. I’m doing everything like in this example: multiwingspan

I’ve used voltometer on the board but it shows “O/C” (screenshot included).
Please be patient - as I said I’m a absolutely beginner :wink:

just_me: I've used voltometer on the board but it shows "O/C" (screenshot included).


Is that when the button is pressed or when it is not pressed?

If it is when it is not pressed, check the voltage on the 5V rail of your breadboard. If that is 0V, check the voltage at the 5V pin on the Arduino. Maybe you have a bad connecting wire?


It could be that you placed the push button in the wrong way. If you look at the sides of the push button you will notice that you have two sides without legs and two sides with two legs each. Some push buttons have internal connections that directly connect two legs together. If you look at the side that has legs, the opposite legs are usually connected with each other. If you look at the image and you rotate the switch 90 degrees you will see that the 5V is shorted via the resistor directly to ground. This will mean your input will always be LOW no matter how often you press the button :slight_smile:

Thank You for Yours answers.

I’ve made prototype again, without programming it. I’ve connected only momentary button, resistor (10k, normal) and voltometers.

  1. When I turn on the circuit everything looks fine (screen 1).
  2. When I push the button I’m getting short circuit (warning icons).

What am I doing wrong? I’ve absolutely no idea.
Could You help me?



just_me: 2. When I push the button I'm getting short circuit (warning icons).

You are using some sort of simulator and not a real Arduino and led?

If so, I would say the simulator is wrong. I can't see anything wrong with the way you have wired it up. Should work OK on a real Arduino.

Well the simulator is VBB and it's a circuit modelling tool rather than exact analog(SPICE) simulator. As such there are some tricks you need to be aware of when modelling analog circuits.

In this case the resistor is being used as a pullup resistor and in VBB you need to set the property of a resistor as 'pullup' in order for it to work as a pullup.

It's a common gotcha. Actually here is a short tutorial on the issue.

So if you set the resistor on the momentary button to be a pullup things should start working as expected.

Thanks for the question.