fabianmoronzirfas
1/22/2015 - 6:46 PM

how to calibrate an LDR connected to A0 https://raw.githubusercontent.com/fabiantheblind/analogio/master/light_dependend_resistor/light_depe

    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);
    }