Description
Related Tags
from ptpma.components import PMAPotentiometer, PMALed
from time import sleep

potentiometer = PMAPotentiometer("A0")
red = PMALed("D2")
yellow = PMALed("D0")
green = PMALed("D1")

while True:
    print(potentiometer.position)
    sleep(0.1)
    if potentiometer.position <333:
        red.on()
        yellow.off()
        green.off()
    elif potentiometer.position >334 and potentiometer.position <666:
        red.off()
        yellow.on()
        green.off()
    elif potentiometer.position >667:
        red.off()
        yellow.off()
        green.on()