sprkfun的micro:bit底座的資料:micro:bit Breakout Board Hookup Guide
micro:bit版本:V2
MakeCode測試:
擴展套件:Adafruit Neopixel Driver
積木程式:
改採Python Editor:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from microbit import * import neopixel from random import randint # Setup the Neopixel strip on pin0 with a length of 8 pixels np = neopixel.NeoPixel(pin0, 16) np.clear() while True: #Iterate over each LED in the strip for pixel_id in range(0, len(np)): red = randint(0, 255) green = randint(0, 255) blue = randint(0, 255) # Assign the current LED a random red, green and blue value between 0 and 60 np[pixel_id] = (red, green, blue) # Display the current pixel data on the Neopixel strip np.show() sleep(300) |
沒有留言:
張貼留言