User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
start [2014/01/25 11:17]
admin created
start [2022/04/18 10:48]
admin
Line 1: Line 1:
 Good stuff to follow. Good stuff to follow.
 +====== Millis not Delay ======
 +
 +<​code>​
 +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;​
 +  }
 +}
 +</​code>​
start.txt ยท Last modified: 2022/04/19 14:06 by admin