Go Down

Topic: How to connect push button for increment purpose? (Read 644 times) previous topic - next topic

kurtselva

Hi all,

I need to connect a pushbutton to my arduino for increment purpose:

So what I need is when I push the button once, the value reflecting in the LCD will increase by 1. If I press the button again, the value will increase by 1 again until it reaches a certain value where it goes back to the minimum value again..

So my question for such a set up, how are we supposed the connect the push button to the arduino?
is it as follows:http://www.arduino.cc/en/Tutorial/Pushbutton

or am I supposed to connect it to the analogue pin instead?

Thanks!

Grumpy_Mike

Quote
how are we supposed the connect the push button to the arduino?
is it as follows:http://www.arduino.cc/en/Tutorial/Pushbutton

Yes.

However I think your problem is you don't know what to do with it in the software.
Try this:-
http://arduino.cc/en/Tutorial/ButtonStateChange

kurtselva

Thanks for clearing my doubt.

Actually I understand that how we want the pushbutton to act depends on how we code..But got confused when I saw a few examples online where the analogue pin was connected to the pushbutton..

So what is there any difference in connecting the pushbutton to digital pin and analogue pin?

Grumpy_Mike

Quote
is there any difference in connecting the pushbutton to digital pin and analogue pin?

Not much. You can use the analogue pins in a digital mode analogue 0 being pin 14 1 being 15 and so on.
Or you can do an analogue read, it takes much longer that a digital read but is still only 0.1mS so you won't notice the difference.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy