User Tools

Site Tools


start

This is an old revision of the document!


Good stuff to follow. ====== Millis not Delay

unsigned long eventInterval;
unsigned long previousTime;
void setup()
{
    eventInterval=5000 // 5 seconds
    previousTime=millis();
}
void loop() {
unsigned long currentTime = millis();

  /* This is the event */
  if (currentTime - previousTime >= eventInterval) {
    /* Event code */
    Serial.println("Timeout");
    
   /* Update the timing for the next time around */
    previousTime = currentTime;
  }
}
start.1650293264.txt.gz · Last modified: 2022/04/18 10:47 by admin