Coding Two LEDs and Potentiometer with cut off time on

I am new to the Arduino world
i have built a circuit using x2 LEDs and a potentiometer

i want to have the potentiometer as input and LEDS as outputs independently depending on the input value range.

potentiometer input ranges
204.8 * 4.75v = 972.8 (high limit)
204.8 * 0.25v = 51.2 (low limit)
204.8 * 2.5v = 512 (mid-point)

when the value is drops below 512(2.5V) and stays in the range (between 52-512) i want the LED to come on but have a TIME LIMIT of 5 minutes max operating time and then cut out.
i don't need a time limit on the above 512 range LED just the Below one.
if the potentiometer goes above or below the min and max the LEDs will turn off.

any ideas or help would be great thanks. this new language is hard to take on board. but very interesting and exciting with its capability's. just my ability's aren't there yet hahaha

OK, so you apparently realise it is pointless using floating point here, you just need to determine the integer value corresponding to your chosen thresholds.

You need to practice the art of timing things. You need to study this tutorial and this.


Here is an example sketch.ino - Wokwi Arduino Simulator

Thank you for reply and info. i will read through them and see how i get on.

Thanks great stuff i will have a look at it :smile: