Created
January 29, 2018 00:32
-
-
Save AndrewTheTM/b31ec7d84fdca4fb31dbdfa4b9b54d1d to your computer and use it in GitHub Desktop.
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
# NeoPixel library strandtest example | |
# Author: Tony DiCola (tony@tonydicola.com) | |
# | |
# Direct port of the Arduino NeoPixel library strandtest example. Showcases | |
# various animations on a strip of NeoPixels. | |
import time | |
from neopixel import * | |
# LED strip configuration: | |
LED_COUNT = 40 # Number of LED pixels. | |
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!). | |
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz) | |
LED_DMA = 10 # DMA channel to use for generating signal (try 10) | |
LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest | |
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift) | |
LED_CHANNEL = 0 | |
LED_STRIP = ws.SK6812_STRIP_RGBW | |
#LED_STRIP = ws.SK6812W_STRIP | |
COLUMNS = 10 | |
ROWS = 5 | |
def colorStripe(strip, wait_ms=50): | |
for c in range(1, COLUMNS): | |
for r in range(1, ROWS): | |
if r % 2 == 0: | |
strip.setPixelColor((r - 1) * COLUMNS + COLUMNS - c, Color(255, 0, 0)) | |
else: | |
strip.setPixelColor((r - 1) * COLUMNS + c, Color(255, 0, 0) | |
strip.show() | |
while(True): | |
colorStripe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment