Go Down

Topic: Need help with 7 segment displays. (also, is this the right section for this?) (Read 1 time) previous topic - next topic

Grumpy_Mike

You need to add some debug prints to see what is happening. I changed the end of your code to this:-
Code: [Select]
if (currentTime2 - oldTime2 > counter2){
        if (keepTrack == 1) {
          keepTrack2 = thousands;
        }
        else if (keepTrack == 2) {
          keepTrack2 = hundreds;
        }
        else if (keepTrack == 3) {
          keepTrack2 = tens;
        }
        else if (keepTrack == 4) {
          keepTrack2 = units;
        }
        else {
          keepTrack2 = 4;
        }
        // settoDisp(keepTrack, keepTrack2);
        Serial.print(keepTrack);
        Serial.print(" -> ");
        Serial.println(keepTrack2);
        keepTrack--;
}

Having first done a serial begin in the setup.

If you run this you will find it stops after a few bursts of activity. You will also find that the variable keepTrack keeps getting more negative. You are not updating oldTime2 correctly, this should only be updated inside that if statement, can you think why?

Go Up