Adafruit_Learning_System_Gu.../MetroX_CircuitPython/mib_potentiometer_threshold.py
2021-01-29 09:32:13 -05:00

21 lines
417 B
Python
Executable file

"""
'mib_potentiometer_THRESHOLD.py'.
=================================================
turns on a LED when the potentiometer is above a half-turn
"""
import analogio
import board
import digitalio
LED = digitalio.DigitalInOut(board.D13)
LED.switch_to_output()
POT = analogio.AnalogIn(board.A0)
THRESHOLD = 512
while True:
if POT.value > THRESHOLD:
LED.value = True
else:
LED.value = False