Files
hw-hacking-101/code-snippets/ADC_Photo_Resistor.py

9 lines
215 B
Python

from machine import ADC, Pin
from time import sleep
adc = ADC(Pin(34)) # create an ADC object acting on a pin
adc.atten(ADC.ATTN_11DB) # 3.3V max
while True:
print("Analog Value: " , adc.read())
sleep(1)