Skip to content
Snippets Groups Projects
Commit 29b90b05 authored by ef1g21's avatar ef1g21
Browse files

Upload New File

parent 27329d3a
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment