hello,
I'm trying a project that only I can do it, unfortunately, not quite with the if function.
I can do it when both timers run, it is alternated.
And if only one timer is running, the then only displayed.
But running both times and I think the first time, he ceases to change (which fits so then), but he then shows the 2.te time (which still runs).
I want now but get displayed the standing time
Thanks in advance
Markus1995
Code of issue:
int i=(millis()/3000)%2; // Welcher Timer ist zur Darstellung dran?
// Wenn nur ein Timer aktiv zählt, und der andere Timer steht, wird stets der stehende Timer angezeigt
if (timerActive[0]!=timerActive[1]) // Ist nur ein Timer aktiv?
{ // in dem Fall nur den inaktiven Timer darstellen
if (timerActive[0]) i=1; else i=0; // der stehende (andere) Timer wird angezeigt
}
if (display_update1 == 1 && i==1 || display_update2 == 1 && i==1 || timerActive[0] == 0 && i==1){
digitalWrite(latchpin, LOW); // send the digits down to the shift registers!
shiftOut(datapin, clockpin, MSBFIRST, segdisp[1]); // print car lane number
shiftOut(datapin, clockpin, MSBFIRST, segdisp[ones_minutes1]); // print the lower sinutes digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[tens_seconds1]); // print the upper seconds digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[ones_seconds1]); // print the lower seconds digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[tenths1]); // print the tenths digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[hundredths1]); // print the hundredths digit
digitalWrite(latchpin, HIGH);
display_update1 = 0; // reset for next pass thru
}
if (display_update2 == 1 && i==0 || display_update1 == 1 && i==0 || timerActive[1] == 0 && i==0){
digitalWrite(latchpin, LOW); // send the digits down to the shift registers!
shiftOut(datapin, clockpin, MSBFIRST, segdisp[2]); // print car lane number
shiftOut(datapin, clockpin, MSBFIRST, segdisp[ones_minutes2]); // print the lower sinutes digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[tens_seconds2]); // print the upper seconds digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[ones_seconds2]); // print the lower seconds digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[tenths2]); // print the tenths digit
shiftOut(datapin, clockpin, MSBFIRST, segdisp[hundredths2]); // print the hundredths digit
digitalWrite(latchpin, HIGH);
display_update2 = 0; // reset for next pass thru
}