I'm getting strange data from my LDR sensor.
Without any significant changes in light is constantly goes from 0 to its max value 1023 and back.
What could be the problem? Is it possible my LDR sensor is broken?
Code:
int ldr = 0; //analog pin to which LDR is connected
int ldr_value = 0; //variable to store LDR values
void setup()
{
Serial.begin(9600); //start te serial monitor
}
void loop()
{
ldr_value = analogRead(ldr); //reads the LDR values
Serial.println(ldr_value); //prints the LDR values to serial monitor
delay(1000); //wait
}
Output:
0
0
0
0
0
26
102
206
349
505
643
813
957
1023
1023
1023
964
821
633
434
249
83
0
0
0
0
and so on