Hi!
Sorry in advance if this has already been discussed before but I couldn't find anything online about it and I'm struggling.
So I have an OLED screen on which I want to display informations, but it's too little to display every information at once so I want to have multiple "screens" with informations, switching every 3 seconds for example, and I think using modulos would work well for this.
To simplify the problem I started by trying to print "1", then "2", then "3", in the serial monitor, for 3 seconds each. It doesn't work and just switches numbers every millisecond I think. Here's my code:
void setup() {
Serial.begin(9600);
unsigned long millis();
int Time = millis(); // variable counting time
}
void loop () {
int Time = millis();
if (0 <= Time%9000 <= 2999) {
Serial.print("1");
}
if (3000 <= Time%9000 <= 5999) {
Serial.print("2");
}
if (6000 <= Time%9000 <= 8999) {
Serial.print("3");
}
}