Go Down

Topic: 7 segment LED display (Read 2874 times) previous topic - next topic

mozz555

I am trying to m ake an 7 segment LED display count down from 9 to 0 and repaet over and over. I am a newbie at arduino codes so if some one would please give me a link or a code it would appreciated thanks

CrossRoads

#1
Feb 05, 2011, 07:48 pm Last Edit: Feb 05, 2011, 07:50 pm by CrossRoads Reason: 1
You are driving the display direct from arduino pins?
Is your display common anode or common cathode?
Wire it up accordingly per this diagram with 330 ohm resistors, with arduino pins in place of the shift register and per your parts data sheet.

Then write a simple loop to turn the segments on/off to make the numbers you want.
There are, of course, much fancier ways of doing this.
Code: [Select]

segmentA = 2; // assign pin numbers, repeat as needed
void setup()
{
pinmode (segmentA, OUTPUUT);  // set up as outputs, repeat as needed
void loop()
{
// write out 9, assumes that HIGH turns a segment on
//    A
// F    B
//   G
// E    C
//    D

digitalWrite (segmentA,  HIGH);
digitalWrite (segmentB,  HIGH);
digitalWrite (segmentC,  HIGH);
digitalWrite (segmentD,  LOW);
digitalWrite (segmentE,  LOW);
digitalWrite (segmentF,  HIGH);
digitalWrite (segmentG , LOW);
delay(1000); // show it for 1000ms (1 second)
// repeat for 9, 8, 7,6,5,4,3,2,1
} // back to void loop


Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up