Skip to content

Instantly share code, notes, and snippets.

@pcholt
Created March 22, 2023 05:23
Show Gist options
  • Save pcholt/14ed073007093affb93011ad5ca84b6d to your computer and use it in GitHub Desktop.
Save pcholt/14ed073007093affb93011ad5ca84b6d to your computer and use it in GitHub Desktop.
import neopixel, math, time
from machine import Pin
p = Pin(28, Pin.OUT)
px = neopixel.NeoPixel(p,24)
theta = [0.0,0.0,0.0]
delta = [2.1,1.3,-1.5]
while True:
theta = [(theta[i] + delta[i] / 10.0) % (math.pi * 2) for i in range(3)]
for i in range(24):
rho = i * math.pi / 12
px[i] = [
128+int(128*math.cos(rho + theta[0])),
128+int(128*math.cos(rho + theta[1])),
128+int(128*math.cos(rho + theta[2]))
]
px.write()
time.sleep_ms(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment