-
Notifications
You must be signed in to change notification settings - Fork 100
Closed
Description
This is my code
import board
import neopixel
import os
import time
ORDER = neopixel.RGB
# GPIO pin 18 with 8 addressable leds
pixels = neopixel.NeoPixel(board.D18, 10, brightness=0.5, auto_write=False, pixel_order=ORDER)
# initialize all the env variables
BLINK_FEVER_FILE = os.getenv("BLINK_FEVER_FILE")
PROJ_DIR = os.getenv("PROJ_DIR")
# control the led strip off all the individual leds
def lightsOff():
pixels.fill((0, 0, 0))
# control the led strip turn it to red all the individual leds
def lighUp():
pixels.fill((255, 0, 0))
# control the led strip turn it to green all the individual leds
def noLighUp():
pixels.fill((0, 255, 0))
while True:
file = open(PROJ_DIR + BLINK_FEVER_FILE, "r")
value = file.read()
print(value)
time.sleep(2)
if value == '0':
ightsOff()
if value == '1':
lighUp()
if value == '2':
noLighUp()
pixels.show()
Metadata
Metadata
Assignees
Labels
No labels
