Skip to content

Instantly share code, notes, and snippets.

@anecdata
Last active March 9, 2019 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anecdata/868d310dff512389af76a556b0ae1e16 to your computer and use it in GitHub Desktop.
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
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)
@anecdata
Copy link
Author

anecdata commented Mar 7, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment