Hallo,
ich versuche gerade ein Projekt, nur schaffe ich es leider nicht ganz mit den if Funktionen.
Ich schaffe es, wenn beide Zeiten laufen, dass es sich abwechselt.
Und wenn nur eine Zeit läuft, das dann auch nur die angezeigt wird.
Laufen aber beide Zeiten und ich halte die erste Zeit an, hört er auf zu wechseln (das passt ja dann), aber er zeigt dann die 2.te Zeit an ( die ja noch läuft).
Ich möchte nun aber die stehende Zeit angezeigt bekommen
Danke im Vorraus
Markus1995
Code der Ausgabe:
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
}