GlennTech
Active Member
Hey,
I know this is done before, but I would like to post this also.
I've made a bomb gauntlet countdown using and arduino duemilanove and 9 rectangler LEDS.
I'm still prototyping, my goal is a countdown from 9999 to 1. I got the numbers from a Word lettertype/font called Yautja. Blame the font not me for incorrect numbers. If you've to correct one than pm it to me .
This is the hardware
The pin placement
This is incorrect ! I modified the code with other pins. You can keep this hardware but you'll have to adjust the code.
The video (countdown 9 to 1)
If you connect the cathodes of the leds (negative pin) to the ground and the anodes (positive pin) to the corresponding pins then your hardware is finished
You need a code in order to countdown. I made this code very simply, not simplified, so everyone would understand it a bit.
Upload it to the Arduino Duemilanove and you're done!!!
Simple as that.
I know this is done before, but I would like to post this also.
I've made a bomb gauntlet countdown using and arduino duemilanove and 9 rectangler LEDS.
I'm still prototyping, my goal is a countdown from 9999 to 1. I got the numbers from a Word lettertype/font called Yautja. Blame the font not me for incorrect numbers. If you've to correct one than pm it to me .
This is the hardware
The pin placement
This is incorrect ! I modified the code with other pins. You can keep this hardware but you'll have to adjust the code.
The video (countdown 9 to 1)
If you connect the cathodes of the leds (negative pin) to the ground and the anodes (positive pin) to the corresponding pins then your hardware is finished
You need a code in order to countdown. I made this code very simply, not simplified, so everyone would understand it a bit.
Code:
//
byte nine_seg_digits[10][9]=
//Arduino pin: 2,3,4,5,6,7,8,9,10
{{0,0,0,0,0,0,0,0,0}, //0
{1,0,1,1,1,0,1,1,1}, //1
{1,1,1,1,1,0,1,1,1}, //2
{1,0,0,0,0,0,1,1,1}, //3
{1,1,1,0,0,0,1,1,1}, //4
{0,0,1,1,1,1,1,1,1}, //5
{0,1,1,0,0,1,1,1,1}, //6
{0,0,1,1,1,1,1,1,0}, //7
{1,1,1,1,1,0,1,1,1}, //8
{1,1,1,1,1,1,1,1,1} //9
};
int timer = 1000;
int timerEnd = 1000;
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}
void nineSegWrite(byte digit){
byte pin = 2;
for (byte segCount = 0; segCount < 9; ++segCount){
digitalWrite(pin, nine_seg_digits[digit][segCount]);
++pin;
}
}
void loop(){
for(byte count = 10; count>0;--count){
delay(timer);
nineSegWrite(count-1);
}
for(byte count = 10; count>0;--count){
delay(timer);
nineSegWrite(count-1);
}
delay(timerEnd);
}
Upload it to the Arduino Duemilanove and you're done!!!
Simple as that.