8 years, 10 months ago.

Doubts

Doubts about lines:

reading = min;

and

reading = max;

Would not correct :

min = reading;

and

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, 10 months 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.