Created
February 6, 2025 19:04
-
-
Save 28sana9/ccd3a6b49797bee614edc780e05f01c7 to your computer and use it in GitHub Desktop.
myColors3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
import neopixel | |
pixel_pin = board.D2 | |
num_pixels = 16 | |
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.7, auto_write=False) | |
while True: | |
for red_fade_value in range(0, 254, 2): #fade in loop | |
color = (red_fade_value, 0, 0) | |
for light_index in range (0, 16, 1): | |
pixels[light_index] = color | |
pixels.show() | |
for red_fade_value in range(254, 0, -2): #fade out loop | |
color = (red_fade_value, 0, 0) | |
for light_index in range(0, 16, 1): | |
pixels[light_index] = color | |
pixels.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment