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