Skip to content

Instantly share code, notes, and snippets.

@Corteil
Created December 6, 2021 21:37
Show Gist options
  • Save Corteil/06b4b47031343ae3bc0be5c3b9366568 to your computer and use it in GitHub Desktop.
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
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