I am trying to read values off an LDR to control a simple photovore robot. My test code and connection diagram below :
int leftSensor=1; //LDR on analog pin 1
int leftSensorVal=0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
leftSensorVal= analogRead(leftSensor);
Serial.println(leftSensorVal);
delay(1000);
}
However, the values i get seem reversed. ie, as the intensity of light on the LDR increases, the values tend to come closer to 0, and vice versa. eg... under normal indoor light, values are 65, 67, 62...etc. Under bright light, values are 5, 3, 2 etc.