I am using ESP32 WROOM-32 board.
When i read data from light sensor, the first value that i get is correct. After that i change the voltage on the pin. But the data that I get is still on the same level (changes just a little bit).
The input voltage is around 0.5v. I get:
...
533
534
575
...
I change the voltage to 1.8v. But i still get the same:
...
534
546
538
...
I reset and start the program starting with 1.8v input:
...
2009
1958
2007
...
I change the input to 0.5v, but still get the same:
...
2007
2008
2001
...
This is the code:
Code: Select all
from machine import ADC
from machine import Pin
light_sensor = ADC(Pin(33))
light_sensor.atten(ADC.ATTN_11DB)
while True:
print(light_sensor.read())
What is the problem?