adafruit / Adafruit_NeoPixel

Arduino library for controlling single-wire LED pixels (NeoPixel, WS2812, etc.)
GNU Lesser General Public License v3.0
3.12k stars 1.27k forks source link

Arduino Nano RP2040 Connect sends signal for different led strips with same pin #304

Closed HSVDO closed 2 years ago

HSVDO commented 2 years ago

When connecting more than 1 led strip to different digital pins the signal strength is added together and sent as output to the first specified pin. The second pin does not output any signal. When I change the order of the specified pins, the summed signal goes to the second (now configured as first) pin. This gives weird colors as result (see 'current behavior.png'). I tested the code with an Arduino Nano Every and it works fine with that kind of board (see 'expected behavior.png'). I can reproduce this problem with 3 different Arduino Nano RP2040 Connect boards following these steps:

multipleLedStripsExample.zip

  1. Connect two neopixel strips to power supply
  2. Upload sketch to board
  3. Connect the two led strips to the specified pins (e.g. D6 & D7)
  4. Connect board to power supply
  5. Apply power

OR

  1. Upload sketch to board
  2. Measure voltage output on specified pins (e.g. D6 & D7)

Current behavior: current behavior

Expected behavior: expected behavior

Bodmer commented 2 years ago

I have created a pull request #307 for a change to the library that permits up to 8 library instances to be used. So up to 8 independant pixel strands can be controlled, each strand on it's own pin.

PaintYourDragon commented 2 years ago

Issue resolved with PR #307. Thank you!

HSVDO commented 2 years ago

@Bodmer thanks for working on this! Since I couldn't test it before, I tested the new version 1.10.2, but now I run into another error when compiling:

ResolveLibrary(Adafruit_NeoPixel.h) -> candidates: [Adafruit_NeoPixel@1.10.2]

Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:397:3: error: 'PIO' does not name a type; did you mean 'EIO'? PIO pio = pio0; ^~~ EIO

Using board: BN: Arduino Nano RP2040 Connect VID: 2341 PID: 005e

Bodmer commented 2 years ago

OK, it works fine with Earl Philhower's RP2040 board package but I see that the Arduino package throws the error.

I have created a pull request #308 that fixes this.

The fix is that the RP2040 #include files need to be in the header file.

HSVDO commented 2 years ago

It now works fine with the Arduino Nano RP2040 Connect, too. Thanks! :)