Last active
July 3, 2020 06:59
-
-
Save s-light/82fdfe0c98b2fb46f3261bd30473a70f to your computer and use it in GitHub Desktop.
minimal test for NeoPixels with Linux / CircuitPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# minimal test for NeoPixels on Raspberry Pi | |
import time | |
import board | |
import neopixel | |
num_pixels = 2 | |
pixels = neopixel.NeoPixel( | |
board.D18, | |
num_pixels, | |
brightness=1.0, | |
auto_write=False, | |
pixel_order=neopixel.RGBW) | |
while True: | |
print('red') | |
pixels.fill((255, 0, 0, 0)) | |
pixels.show() | |
time.sleep(1) | |
print('green') | |
pixels.fill((0, 255, 0, 0)) | |
pixels.show() | |
time.sleep(1) | |
print('blue') | |
pixels.fill((0, 0, 255, 0)) | |
pixels.show() | |
time.sleep(1) | |
print('white') | |
pixels.fill((0, 0, 0, 255)) | |
pixels.show() | |
time.sleep(1) | |
print('rgb full') | |
pixels.fill((255, 255, 255, 0)) | |
pixels.show() | |
time.sleep(1) | |
print('rgbw 10') | |
pixels.fill((10, 10, 10, 10)) | |
pixels.show() | |
time.sleep(1) | |
print('rgb 1, w 100') | |
pixels.fill((1, 1, 1, 100)) | |
pixels.show() | |
time.sleep(1) | |
print('rgb 1, w 255') | |
pixels.fill((1, 1, 1, 255)) | |
pixels.show() | |
time.sleep(1) | |
print('b 1, w 100') | |
pixels.fill((0, 0, 1, 100)) | |
pixels.show() | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment