29 lines
465 B
Python
29 lines
465 B
Python
from machine import ADC, Pin, PWM
|
|
import time
|
|
|
|
# Anschluss Poti an GP27 und an Plus 3.3 Volt und Minus
|
|
poti = ADC(Pin(27))
|
|
|
|
# LED
|
|
gruen = PWM(Pin(18))
|
|
gelb = PWM(Pin(19))
|
|
rot = PWM(Pin(20))
|
|
|
|
# Variable mdelay = 0
|
|
gruen.freq(1000)
|
|
gelb.freq(1000)
|
|
rot.freq(1000)
|
|
|
|
reading = 0
|
|
|
|
while True:
|
|
|
|
reading = poti.read_u16()
|
|
print(reading)
|
|
gruen.duty_u16(reading)
|
|
gelb.duty_u16(reading)
|
|
rot.duty_u16(reading)
|
|
time.sleep(0.001)
|
|
|
|
|