Skip to content

Conversation

@RetiredWizard
Copy link

These changes should make the library a swap in replacement for code that uses the standard MicroPython builtin neopixel library.

That is by replacing:

import neopixel
npixels = neopixel.NeoPixel(NeoPin,led_count)

with:

try:
    import ws2812
    npixels = ws2812.WS2812(SPI_BUS,led_count)
except:
    import neopixel
    npixels = neopixel.NeoPixel(NeoPin,led_count)

existing code that uses neopixels should work on boards with the builtin library or boards that don't have the neopixel library but have ws2812 neopixels connected to the MOSI pin of the SPI bus.

These changes should make the library a swap in replacement
for code that uses the standard MicroPython builtin neopixel
library.

That is by replacing:

    import neopixel
    npixels = neopixel.NeoPixel(NeoPin,led_count)

with:

    try:
        import ws2812
        npixels = ws2812.WS2812(SPI_BUS,led_count)
    except:
        import neopixel
        npixels = neopixel.NeoPixel(NeoPin,led_count)

existing code that uses neopixels should work on boards with
the builtin library or boards that don't have the neopixel library
but have ws2812 neopixels connected to the MOSI pin of the SPI bus.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant