Go Down

Topic: How to connect push button for increment purpose? (Read 569 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
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview