Last active
March 9, 2019 22:04
-
-
Save anecdata/868d310dff512389af76a556b0ae1e16 to your computer and use it in GitHub Desktop.
Test of built-in red LED and NeoPixel on Feather M4 and PyPortal
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
import board | |
import time | |
from digitalio import DigitalInOut, Direction # , Pull | |
import neopixel | |
import random | |
led = DigitalInOut(board.D13) | |
led.direction = Direction.OUTPUT | |
# PyPortal and Feather M4 schematics show built-in NeoPixel is WS2812B | |
# Use from Adafruit PyPortal Class https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/blob/1939a1e814af9c57e35e5a39ca3f6f784ab843f7/adafruit_pyportal.py | |
# ...this works on my Feather M4, but not on my PyPortal: | |
neo = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) | |
while True: | |
led.value = not led.value | |
neo[0] = (random.randrange(0, 256), random.randrange(0, 256), random.randrange(0, 256)) | |
neo.show() | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: NeoPixel works in 4.0.0 beta 2, but LED doesn't. LED was fixed in some subsequent builds, but NeoPixel was broken. Both now work in 4.0.0-beta.3