import neopixel
import time
import machine
import math
# NeoPixel configuration
num_leds = 256 # Number of LEDs in the matrix
pin = 23 # GPIO pin for NeoPixel data
matrix_width = 16 # Width of the matrix
matrix_height = 16 # Height of the matrix
# Initialize NeoPixel
np = neopixel.NeoPixel(machine.Pin(pin), num_leds)
runs=[0,0,0]
for num in range(num_leds):
print(runs)
np[runs[0]]=((0,0,0))
np[runs[1]]=((0,0,0))
np[runs[2]]=((0,0,0))
np.write()
runs[0]=min(0+num,0+num%num_leds)
np[runs[0]]=((0,255,0))
runs[1]=min(1+num,1+num%num_leds)
np[runs[1]]=((0,255,0))
runs[2]=min(2+num,2+num%num_leds)
np[runs[2]]=((0,255,0))
np.write()
time.sleep(0.1)
# Clear the NeoPixel matrix
np.fill((0, 0, 0))
np.write()