unsigned long TempsPrecedent1 = 0;
unsigned long TempsPrecedent2 = 0;
unsigned long TempsPrecedent3 = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
/* Updates frequently */
unsigned long TempsCourant = millis();
/* This is the event */
if (TempsCourant - TempsPrecedent1 >= 3000) {
/* Event code */
Serial.println("Interval 3sec ");
/* Update the timing for the next time around */
TempsPrecedent1 = TempsCourant;
}
if (TempsCourant - TempsPrecedent2 >= 1000) {
/* Event code */
Serial.println("Interval 1 sec ");
/* Update the timing for the next time around */
TempsPrecedent2 = TempsCourant;
}
if (TempsCourant - TempsPrecedent3 >= 10000) {
/* Event code */
Serial.println("Interval 10sec");
/* Update the timing for the next time around */
TempsPrecedent3 = TempsCourant;
}
}