Im trying to let a 7 segment display count down from 6 to 1 without delay but it does not seem to be working. I have no idea whats wrong so i hope you can help me.
I have made the function to check the time. In this function i give a parameter to check whether the time has passed. If it has, it returns true, else false.
This is the array that contains the umbers for the 7segment display. It goes from 6 to 1:
byte counterBytes[] = {B01111110, B00111110, B00101101, B00111011, B01011011, B00100001};
This is the main loop where i first create 6 timers. Each of them gets 1000 milliseconds more than the previous one. If a timer has passed it has to write the next number of the array to the 7segment.
void loop(){
for (int i = 0; i < 6000; i = i + 1000) {
timer(i); //start 6 timers
for (int j = 0; j < 6; j++) {
if (timer(i) == true) {
dataWrite(counterBytes[i]);
}
}
}
}
Except it does not. Im not sure but i think the bytes don’t clear and that the next one goes over the other one. This course every segment to light up. Who can help me overcome this problem?
Thanks in advance