Add initial files for the HH Hacking 101 - code and infos about board will follow soon
This commit is contained in:
9
code-snippets/ADC_Photo_Resistor.py
Normal file
9
code-snippets/ADC_Photo_Resistor.py
Normal file
@@ -0,0 +1,9 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user