8 years ago.


Doubts about lines:

reading = min;


reading = max;

Would not correct :

min = reading;


max = reading;

Question relating to:

Simple autodimmer program with ldr. Calibration is done by setting minimum and maximum brightness. Linear interpolation is used to calculate pwm-output value. AutoDimmer o'lux + Set maximum brightness - Set … Analog, ldr, pwm, Serial

1 Answer

8 years ago.

No. Those lines are to ensure that the reading is within the expected range not to set the max and min values. It is expected that the max and min have already been set correctly.