# rood, groen, blauw loop
# LET OP COMMON KATHODE !!!!
#
from machine import Pin, ADC, PWM
from time import sleep
sleep(1)
print("PWM met 3 potentiometers")
roodLedPin = 7
groenLedPin = 8
blauwLedPin = 9
roodPotPin = 28
groenPotPin = 27
blauwPotPin = 26
pauze = .1
## Common KATHODE !!!!!!
aan = 2**16
uit = 0
#roodRGB = Pin(roodLedPin, Pin.OUT)
#groenRGB = Pin(groenLedPin, Pin.OUT)
#blauwRGB = Pin(blauwLedPin, Pin.OUT)
roodRGB = PWM(roodLedPin)
groenRGB = PWM(groenLedPin)
blauwRGB = PWM(blauwLedPin)
roodRGB.freq(1000)
groenRGB.freq(1000)
blauwRGB.freq(1000)
roodRGB.duty_u16(uit)
groenRGB.duty_u16(uit)
blauwRGB.duty_u16(uit)
roodPot = ADC(Pin(roodPotPin))
groenPot = ADC(Pin(groenPotPin))
blauwPot = ADC(Pin(blauwPotPin))
while True:
potRood = roodPot.read_u16()
potGroen = groenPot.read_u16()
potBlauw = blauwPot.read_u16()
# print(potRood, potGroen, potBlauw)
roodRGB.duty_u16(potRood)
groenRGB.duty_u16(potGroen)
blauwRGB.duty_u16(potBlauw)
sleep(pauze)