Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am new to Arduino so, bear with me. I am trying to make a project for a counter countdown using my Arduino Uno whereby any of the 1 out of 14 pushbutton has been pressed, it decreases a digit number on a seven segment display. & when the pushbutton is not being pressed, the number will increase. So that when all the 14 button is being pressed, the display will show 0. When all of the button is being released, it will show 14.

Also I need guidance on how to install the seven segment display on the Arduino Uno.

share|improve this question
1  
You're interested in a pushbutton read and a seven segment display, which are both common applications with an Arduino. Therefore, if you google "Arduino pushbutton" and "Arduino seven segment", you'll get a LOT more useful/eclectic/visual information than you'll get in one answer here. I just verified the two searches. –  boardbite Oct 11 '12 at 5:37
    
Also look into strobing to save on outputs if your connecting a few 7-segments or a shift register. –  nmushov Dec 14 '12 at 23:42
add comment

2 Answers

The Arduino has a total of 20 pins you can use for whatever you want. D0 through D13 are 'digital' and A0 through A5 are 'analog' but all 20 of those pins can be used for general purpose digital input and output (GPIO).

So lets see you... you want 14 push-buttons so the most straightforward way to do that is to use one pin configured as an input per push-button. There are more 'clever' techniques, but I wouldn't go there as a beginner.

You also want to drive a 7-segment display. Again, the most straightforward way to do that is to use one pin configured as an output per segment. Unfortunately, 7 + 14 = 21 > 20, so you'll be stuck adding additional hardware or doing something 'clever'. You will in any case need to external resistors in a variety of places (i.e. current limiting for LED segments)

So here's what I would do to keep things relatively simple and still fitting on the Arduino's pins. Give each push-button a pin and configure them in software to be inputs with internal pull-ups enabled. That leaves us six pins to generate 7 outputs...

That's actually far more than you technically need if you exploit persistence of vision (POV) to scan 'render' the display. You just need to multiplex or charlieplex the segments of the display. Alternatively, you can use an analog input to decode which of multiple buttons are pressed as described in this article, but it doesn't work well for multiple buttons being pressed at once.

Another option is 'get a bigger arduino' the Mega has something like infinity pins...

share|improve this answer
add comment

There are examples to connect a 7-segment display to an Arduino in the Arduino IDE. Some 7-segment displays are different so check a datasheet or test them before wiring.

My idea on how to code it is to check for the push buttons in the loop and depending on how many buttons are pressed, you set a certain value to the 7-segment display.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.