Problem with push button

Hi There

I seem to stumble on a problem with a push button.
I am reading book Arduino Worksop A hands-on Instruction with 65 Projects by John Boxall exercise 4

This exercise is for testing if button has been pressed then LED will be on for short period of time (depending on delay i set)

I have:
Arduino Uno
Push button
One LED
One Resistor 1K Ohm (autor asked to use 560 ohm but I had smallest 1K)
One 10KOhm (my one reads 8.8K)
One 471K Capacitor (autor uses 100nF, I don't have that one today)
Breadborad
few cables

I have connected on Arduino
D7 to 4J on my breadboard that links to push button (please refer to photos)
D12 to 15J on my breadboard
GND to 13(minus) on breadboard
5V to 13(plus) on Breadboard

Connections on breadboard (apart from connections above from arduino)
LED 15(minus) shorter leg, 15a longer leg
1K Ohm 15e second leg on 15i
Push button 4e and 6e on other side 4h and 6h
Capacitor 471K 4d and 6d
Jumper cable 1 4C to 5(minus)
Jumper cable 2 6C to 6(plus)
8.8K Ohm 4b to 4(minus)

I think I didn't missed anything. ufff

program I have is as follows

// Project 4 - Demonstrating a Digital Input
#define LED 12
#define BUTTON 7

void setup() {
pinMode (LED, OUTPUT); //output for the LED
pinMode (BUTTON, INPUT); //input for the button
}

void loop() {
if (digitalRead (BUTTON) == HIGH)
{
 digitalWrite (LED, HIGH); //turn LED on
 delay (1000); // wait for I am changing value from 0.5 second up to 10 seconds
 digitalWrite (LED, LOW); //Turn off LED
}
}
[sub][/sub]

After program is uploaded to arduino and I press button on breadboard nothing really happens
apart from noise on my PC as you would switch off/disconnect device. But I am not getting light on LED.

While checking and rechecking connections etc I pulled cable that is Ground from breadboard and when I tried to connect it back LED gave light, to ensure that if this from my program I have played with length of how long light is on from 0.5 second up to 10 seconds, and it appears that I am getting correct length how long LED is on.

I am not sure where is the mistake,
is due to fact my capacitor is in different value and same for resistor?
is there problem with something else?

Please see pictures on my dropbox Dropbox - Arduino - Simplify your life

your help will be much appreciated

Welcome!

Text telling us what you have needs to be put into a drawing.
Show us a good schematic of your circuit.
Show us a good image of your wiring.

Edit
Attach things here, forget dropbox.

Did you do a continuity check on the button to see which pins are NO? I tried looking at the pictures but some were not very clear (showing the circuit). It just looks like you have a pulldown resistor from D7 to ground and the switch applying power to D7 when pushed.
If the switch legs were incorrect, D7 would be held HI. (which 'should' keep the led ON).
Not sure what you mean by a 471K capacitor. I would pull it.

Check the switch, or just see if you have 5v on the 8.8K resistor without pushing the button, and with pushing the button.

It looks like you have the +5 and ground hooked up to the push button. I see two white jumpers going from the power rail directly to the pushbutton. If that is the case then every time you push the button you short the +5 to ground.

Due_unto:
It looks like you have the +5 and ground hooked up to the push button. I see two white jumpers going from the power rail directly to the pushbutton. If that is the case then every time you push the button you short the +5 to ground.

That’s what I figured even without looking at the photos. It would also explain the “noise on my PC as you would switch off/disconnect device” that was reported.

Hi there :slight_smile:

I am awaiting new short jumpers so I will send updated photos and more description.
I tried to upload pictures here but there is limit of 1MB that's the reason why I used dropbox.

thank you for your assistance

LarryD:
Welcome!

Text telling us what you have needs to be put into a drawing.
Show us a good schematic of your circuit.
Show us a good image of your wiring.

Edit
Attach things here, forget dropbox.

LarryD:
Welcome!

Text telling us what you have needs to be put into a drawing.
Show us a good schematic of your circuit.
Show us a good image of your wiring.

Edit
Attach things here, forget dropbox.

Hi there

I didn't done continuity check I tough that push button is momentary tactile button so only connects pins when pressed. (Am I getting something wrong?)

" It just looks like you have a pulldown resistor from D7 to ground and the switch applying power to D7 when pushed. " I have to walk that trough when I am back home, so I understand this correctly.

" Not sure what you mean by a 471K capacitor. I would pull it."
it is Capacitor with value 471K on it. Similar to this one https://www.amazon.co.uk/2PF-0-1UF-300PCS-ceramic-capacitor-Assorted/dp/B00Q6F3EZ6/ref=sr_1_1?ie=UTF8&qid=1477656708&sr=8-1&keywords=capacitor+ceramic

Parts and schematics comes form book I am following.

tinman13kup:
Did you do a continuity check on the button to see which pins are NO? I tried looking at the pictures but some were not very clear (showing the circuit). It just looks like you have a pulldown resistor from D7 to ground and the switch applying power to D7 when pushed.
If the switch legs were incorrect, D7 would be held HI. (which 'should' keep the led ON).
Not sure what you mean by a 471K capacitor. I would pull it.

Check the switch, or just see if you have 5v on the 8.8K resistor without pushing the button, and with pushing the button.

After program is uploaded to arduino and I press button on breadboard nothing really happens
apart from noise on my PC as you would switch off/disconnect device.

That means, as others have said that you are shorting out 5V and ground. This pulls a lot of current from your USB port and the computer disconnects it.

You have wired up the push button incorrectly. I don't know why you need short jumpers before you can fix this. Just wire it up correctly. For the small "tack" switches, those with a pin at each corner it is easy to get this wrong so always wire them by using two wires only, across opposite corners, leave the other two pins unwired.

The real way to wire it up is to put one wire to the Arduino input pin and the other to ground. Then enable the internal pull up resistors with a pinMode( pin, INPUT_PULLUP ) call.

Hi,

I tried to upload pictures here but there is limit of 1MB that's the reason why I used dropbox.

Load your image into Paint or any graphics app and do a resize.

Tom.... :slight_smile: