4912Views2Replies

Author Options:

How can i make an up/down counter with arduino? Answered

I would like some help making a 2 digit up/down counter with arduino that resets to a preset-able number and how to connect it to a 2 digit 7-segment display, all responses are appreciated.

Tags:arduino

Discussions

Also, if you are still unsure after checking the resources below take a look at the posts tagged 7-segment display on my blog. There are two simple projects (spread out into 7 or 8 posts), one using a 1-digit display, and one using a 2-digit display. It only counts up, but I share the source code which can be easily modified (as described in the answer below) to decrement the counter as well. Good luck!

www.arduino.cc

look at learning, 'reference' and 'playground' sections of the site - they discuss how to interface with hardware (buttons, leds, displays, etc) , basic to advanced programming, and an entire help community on the forums.

As for the program it would basically look like:

setup(
initial value = whatever;
incrementpin = whatever;
decrementpin = whatever;
resetbuttonpin = whatever;
ledpins = blablabla;
)

Loop
output the number to the 7 segment displays
check for a button
if a button, increment/decrement the number
if resetbutton, set counter to intial value;
loop