# NeoPixels Rainbow on MicroPython
# Wokwi Example https://wokwi.com/arduino/projects/305569065545499202
from machine import Pin
from neopixel import NeoPixel
from time import sleep
pos = 0
maxpix = 100
pixels = NeoPixel(Pin(15), maxpix)
def handle_interrupt(pin):
global pos
pos = pos + 1
if pos > maxpix:
pos = 0
pixels.fill((0,0,0))
pixels[pos] = (0,255,0)
pixels.write()
p1 = Pin(21, Pin.IN)
p1.irq(trigger=Pin.IRQ_RISING, handler=handle_interrupt)