Go Down

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


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


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: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


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