from RGB import *
from machine import Pin,PWM
redPin=13
greenPin=12
bluePin=14
redLED=PWM(Pin(redPin))
greenLED=PWM(Pin(greenPin))
blueLED=PWM(Pin(bluePin))
redLED.freq(1000)
redLED.duty_u16(0)
greenLED.freq(1000)
greenLED.duty_u16(0)
blueLED.freq(1000)
blueLED.duty_u16(0)
def makecolor(mc):
redVal,greenVal,blueVal=rgb[myColor]
redLED.duty_u16(int(65535/255*redVal))
greenLED.duty_u16(int(65535/255*greenVal))
blueLED.duty_u16(int(65535/255*blueVal))
try:
while True:
myColor=input('What Color Do You Desire: ')
myColor=myColor.lower()
if myColor not in rgb:
print(myColor,'IS not a valid color, please enter valid color')
if myColor in rgb:
makecolor(myColor)
except KeyboardInterrupt:
redLED.duty_u16(0)
greenLED.duty_u16(0)
blueLED.duty_u16(0)