from machine import Pin
from time import sleep
redLEDPin=17
greenLEDPin=18
blueLEDPin=19
myRedLED=Pin(redLEDPin,Pin.OUT)
myGreenLED=Pin(greenLEDPin,Pin.OUT)
myBlueLED=Pin(blueLEDPin,Pin.OUT)
redButtonPin=13
greenButtonPin=8
blueButtonPin=3
myRedButton=Pin(redButtonPin,Pin.IN,Pin.PULL_UP)
myGreenButton=Pin(greenButtonPin,Pin.IN,Pin.PULL_UP)
myBlueButton=Pin(blueButtonPin,Pin.IN,Pin.PULL_UP)
redButtonStateNow=1
greenButtonStateNow=1
blueButtonStateNow=1
redButtonStateOld=1
greenButtonStateOld=1
blueButtonStateOld=1
redLEDState=False
greenLEDState=False
blueLEDState=False
while True:
    redButtonStateNow=myRedButton.value()
    greenButtonStateNow=myGreenButton.value()
    blueButtonStateNow=myBlueButton.value()
#Check to see if buttons work
    print(redButtonStateNow, greenButtonStateNow, blueButtonStateNow)
    sleep (.1)
    if redButtonStateOld==1 and redButtonStateNow==0:
        redLEDState= not redLEDState
        myRedLED.value(redLEDState)
    redButtonStateOld=redButtonStateNow
    
    if greenButtonStateOld==1 and greenButtonStateNow==0:
        greenLEDState= not greenLEDState
        myGreenLED.value(greenLEDState)
    greenButtonStateOld=greenButtonStateNow
    
    if blueButtonStateOld==1 and blueButtonStateNow==0:
        blueLEDState= not blueLEDState
        myBlueLED.value(blueLEDState)
    blueButtonStateOld=blueButtonStateNow
