how to calibrate an LDR connected to A0 https://raw.githubusercontent.com/fabiantheblind/analogio/master/light_dependend_resistor/light_dependend_resistor_bb.png
int minValue = 1023;
int maxValue = 0;
void setup(){
}
void loop(){
int val = analogRead(A0);
if(val < minValue){
minValue = val;
}
if(val > maxValue){
maxValue = val;
}
int mapped_value = map(val,minValue,maxValue,0,127);
}