Makuna / NeoPixelBus

An Arduino NeoPixel support library supporting a large variety of individually addressable LEDs. Please refer to the Wiki for more details. Please use the GitHub Discussions to ask questions as the GitHub Issues feature is used for bug tracking.
GNU Lesser General Public License v3.0
1.18k stars 265 forks source link

error: 'NOT_A_PIN' was not declared in this scope #729

Closed kurogedelic closed 8 months ago

kurogedelic commented 1 year ago

Thanks for a wonderful library ! I tried "NeoPixelTest.ino" build for SAMD21 architectures e.g. Seeed XIAO M0, Arduino M0. there's compile error.

In file included from /private/var/folders/gs/fy565xcd6w5bv4vq3hcrzpbw0000gn/T/.arduinoIDE-unsaved202379-5579-tlr700.2kho/NeoPixelTest/NeoPixelTest.ino:14:0:
/Users/[user]/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/NeoPixelBus.h:73:118: error: 'NOT_A_PIN' was not declared in this scope
     NeoPixelBus(uint16_t countPixels, uint8_t pinClock, uint8_t pinData, uint8_t pinLatch, uint8_t pinOutputEnable = NOT_A_PIN) :
                                                                                                                      ^~~~~~~~~
/Users/[user]/Documents/Arduino/libraries/NeoPixelBus_by_Makuna/src/NeoPixelBus.h:73:118: note: suggested alternative: 'NOT_A_PORT'
     NeoPixelBus(uint16_t countPixels, uint8_t pinClock, uint8_t pinData, uint8_t pinLatch, uint8_t pinOutputEnable = NOT_A_PIN) :
                                                                                                                      ^~~~~~~~~
                                                                                                                      NOT_A_PORT

exit status 1

Compilation error: exit status 1

thanks

Makuna commented 1 year ago

This is a bug for the board package owner. I searched, and for some reason they use PIN_NOT_A_PIN instead of the standard NOT_A_PIN. I would suggest raising the issue with them.

In the mean time, before you include NeoPixelBus, just add this...

#define NOT_A_PIN PIN_NOT_A_PIN

and it should work.

Note, the final value of this symbol is highly dependent on the uC maker, sometimes it 0, sometimes its -1, in this case its UINT_MAX.

kurogedelic commented 1 year ago

I added in my .ino "#define NOT_A_PIN PIN_NOT_A_PIN" but I get a similar error. (on any line) Replacing it with "NOT_A_PORT" by IDE suggestion also fails.

I will report it to the board package project. thanks.

Makuna commented 1 year ago

I added a workaround in this pull. https://github.com/Makuna/NeoPixelBus/pull/730

Makuna commented 8 months ago

Also added where there was no alternative to map it to -1.