Design and make a big LED 7-Segment for Arduino
Design and make a big LED 7-Segment for Arduino using BCD to 7segment IC 4511
Parts list:
IC4511
LED (35pcs)
Resisror 120R (7pcs)
Male header pin (6 pin+3 pin)
Connecting wires
Circuit:
IC4511 has sourcing current=25mA for each segment, I used five parallel Green LEDs for each segment,i test the total current drawing is only 20mA(4mA each LED), but if you want to use another LED color which make the total current drawing more than 25mA for each segment so you have to add switching transistor for each segment.
I chooses Green color LED because draw very very low current and make the circuit simple as possible(No switching transistor needed).
Code:
void setup(){
pinMode(2, OUTPUT); //A
pinMode(3, OUTPUT); //B
pinMode(4, OUTPUT); //C
pinMode(5, OUTPUT); //D
}
void loop(){
//Number Zero
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number One
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number Two
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number Three
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number Four
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Five
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Six
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Seven
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Eight
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(1000);
//Number Nine
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(1000);
}
pinMode(2, OUTPUT); //A
pinMode(3, OUTPUT); //B
pinMode(4, OUTPUT); //C
pinMode(5, OUTPUT); //D
}
void loop(){
//Number Zero
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number One
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number Two
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number Three
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
//Number Four
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Five
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Six
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Seven
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(1000);
//Number Eight
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(1000);
//Number Nine
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(1000);
}
Komentar
Posting Komentar