Created
December 6, 2021 21:37
-
-
Save Corteil/06b4b47031343ae3bc0be5c3b9366568 to your computer and use it in GitHub Desktop.
code for pocketmoneytronics.co.uk RGB Xmas tree for a Raspberry Pi or a Raspberry Pi Pico written in circuitpython
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 board | |
import neopixel | |
from time import sleep | |
from random import randint | |
# Update this to match the number of NeoPixel LEDs connected to your board. | |
num_pixels = 6 | |
pixels = neopixel.NeoPixel(board.GP18, num_pixels) | |
pixels.brightness = 0.05 | |
for pix in range(num_pixels): | |
pixels[pix] = (randint(0, 255), randint(0, 255), randint(0, 255)) | |
while True: | |
pixels[randint(0,(num_pixels-1))] = (randint(0, 255), randint(0, 255), randint(0, 255)) | |
pixels.show() | |
sleep(0.05) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment