Today i made LED light
I code it first
# Write your code here :-)
from lib import neopixel
import board
import time
pin = board.GP22
num_pixels = 9
pixels = neopixel.NeoPixel(pin, num_pixels, brightness=0.3, auto_write=True)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
PINK = (247, 0, 255)
GRAY = (152, 169, 171)
BROWN = (138, 62, 4)
ORANGE = (255, 123, 0)
SHER = (4, 217, 139)
BLACK = (0,0,0)
offset = 1
while True:
pixels.fill(BLACK)
pixels[(0 + offset)%num_pixels] = BLUE
pixels[(1 + offset)%num_pixels] = GREEN
pixels[(2 + offset)%num_pixels] = PINK
pixels[(3 + offset)%num_pixels] = GRAY
pixels[(4 + offset)%num_pixels] = BROWN
pixels[(6 + offset)%num_pixels] = ORANGE
pixels[(7 + offset)%num_pixels] = SHER
pixels[(8 + offset)%num_pixels] = RED
time.sleep(0.2)
offset += 1
What this code dose ______ pixels[(0 + offset)%num_pixels] = BLUE
pixels[(1 + offset)%num_pixels] = GREEN
pixels[(2 + offset)%num_pixels] = PINK
pixels[(3 + offset)%num_pixels] = GRAY
pixels[(4 + offset)%num_pixels] = BROWN
pixels[(6 + offset)%num_pixels] = ORANGE
pixels[(7 + offset)%num_pixels] = SHER
pixels[(8 + offset)%num_pixels] = RED
time.sleep(0.2)
offset += 1
by this we can move the LED or light