Skip to content

Unable to control the last 2 unit of the led #86

@kenken64

Description

@kenken64

20200529_200925

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions