from neopixel import NeoPixel
from machine import Pin
from time import sleep
pin = Pin(10, Pin.OUT) # set GPIO0 to output to drive NeoPixels
np = NeoPixel(pin, 2) # create NeoPixel driver on GPIO0 for 8 pixels
while True :
np[0] = (0,0,20) # set the first pixel to white
np[1] = (0,20,0) # set the first pixel to white
np.write() # write data to all pixels
sleep(0.4)
np[0] = (0,20,0) # set the first pixel to white
np[1] = (0,0,20) # set the first pixel to white
np.write() # write data to all pixels
sleep(0.4)
#r, g, b = np[0] # get first pixel colour
#print (r,g,b)
Comments