Go Down

Topic: temperature.. please answer (Read 162 times) previous topic - next topic

what code can i use to check the temperature every 5 sec with lm35 ?

johnwasser

Code: [Select]

const unsigned long interval = 5000;           // Interval between samples, in milliseconds

void setup() {   
}

void loop() {
    static unsigned long previousMillis = 0;
    unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval)  {
     previousMillis = currentMillis;
     // The code in this block is executed every 'interval' milliseconds

  }
}
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

robtillaart


Great  that is "temperature reading without delay()"  :)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up