Go Down

Topic: temperature.. please answer (Read 266 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

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131