diff --git a/chooseAColour.py b/chooseAColour.py new file mode 100644 index 0000000000000000000000000000000000000000..08f9e115e43db5a22614d4380a5d77cfbc645977 --- /dev/null +++ b/chooseAColour.py @@ -0,0 +1,56 @@ + +from neopixel import Neopixel +import utime + +led = Neopixel(1, 0, 28, "RGB") # 1 LED, state machine 0, GP28 pin, RGB colour mode + +blue = (195, 0, 90) +red = (0,255, 0) +green = (255, 50, 0) +yellow = (255, 255, 0) +pink = (105, 255, 104) + + + + + + +while True: + print( "To switch off the LED enter 'off'") + print("Predefined colours are blue,red,green,yellow and pink") + user = input("Enter the colour if you want from predefined colours:" ) + user_input = user.strip() + print("You entered:", user_input) + + if user_input == "blue": + led.set_pixel(0, blue) + led.show() + + + elif user_input =="green": + led.set_pixel(0, green) + led.show() + + elif user_input =="red": + led.set_pixel(0, red) + led.show() + + elif user_input =="yellow": + led.set_pixel(0, yellow) + led.show() + + elif user_input =="off": + led.set_pixel(0, (0,0,0)) + led.show() + + elif user_input =="pink": + led.set_pixel(0, pink) + led.show() + + + + + + + + \ No newline at end of file