Pages: [1]   Go Down
Author Topic: How to connect push button for increment purpose?  (Read 500 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33314
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33314
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: