I'm a newcomer to Arduino, trying to read analog values from a circuit with a photoresistor. I believe I am using a 1-ohm resistor
The problem I am having is that my photoresistor does not seem to be working, or my circuit is wrong. When I run the below code on my Nano, my Serial monitor constantly prints 1023. When I cover the photoresistor completely with my finger, the value dips down to 900-950, but then jumps back up to 1023. It dips down to 900-950 again, and jumps back to 1023. This happens continuously.
Here is my code:
void setup()
{
Serial.begin(9600);
}
void loop()
{
int value = analogRead(A0);
Serial.println(value);
delay(20);
}
Here is an image of the circuit I am using. In my case, I am using a Nano instead of Uno.
I ran the above code on the virtual circuit above, and it works as expected. However, on my physical device, the phenomenon I explained above occurs.
Is there something wrong with my circuit? Could it be an issue with my photoresistor?