Displaying the max and min temperature

Hello ! :slight_smile:

I'm actually trying to display the maximum and the minimum temperature while my arduino uno is running :

  • For exemple if the actual temperature is 10°C and change to 9°C 1 minute later, i want my console show me : Minimum temperature : 9°C until it changes to another lower value and the same for the max temperature until it changes to an higher value

And here is my actual not working "script", the value don't wanna change !

Hope you understood !
Thanks ! :slight_smile:

NRPC:
Hello ! :slight_smile:

I'm actually trying to display the maximum and the minimum temperature while my arduino uno is running :

  • For exemple if the actual temperature is 10°C and change to 9°C 1 minute later, i want my console show me : Minimum temperature : 9°C until it changes to another lower value and the same for the max temperature until it changes to an higher value

And here is my actual not working "script", the value don't wanna change !
Screenshot by Lightshot

Hope you understood !
Thanks ! :slight_smile:

you will need to make some of those variables persistent if you want to maintain their values each time loop() terminates.

so read up on scope and the static keyword

BulldogLowell:
you will need to make some of those variables persistent if you want to maintain their values each time loop() terminates.

so read up on scope and the static keyword

Thank you for your fast answer! :slight_smile:

I found the scope and it works fine for the Max Temperature, but not for the minimal temperature, because, i think the default value of the variable is 0, and i actually can't take it under 0°C.
But this is not what i want, i want to display the min temp. even when it's above 0 :smiley:

NRPC:
But this is not what i want, i want to display the min temp. even when it's above 0 :smiley:

post your revised code, not a link to an image...

you had more than one scope related issue.

But this is not what i want, i want to display the min temp. even when it's above 0

Make the initial value of minTemperature = 100. Then any value under 100 will become the new minimum.

Or read the temp once at the first. Both max and min should start with that.