Skip to content

Instantly share code, notes, and snippets.

View 29liachen-pixel's full-sized avatar

29liachen-pixel

  • Joined Apr 28, 2026
View GitHub Profile
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
# Setup switch
switch = DigitalInOut(board.D3)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
import time
import board
import neopixel
from digitalio import DigitalInOut, Direction, Pull
switch = DigitalInOut(board.D3)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
pixel_pin = board.D2
import time
import analogio
import board
import neopixel
photocell_pin = board.A2 #pin 0 is Analog input 2
photocell = analogio.AnalogIn(photocell_pin)
light = photocell.value
pixel_pin = board.D2
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:
import board
import neopixel
import time
pixel_pin = board.D2 #the ring data is connected to this pin
num_pixels = 16 #number of leds pixels on the ring
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
RED = (255, 0, 0) # RGB