Not sure why I keep getting this error. I'm using the example code for Macro Pad RP2040 (https://learn.adafruit.com/adafruit-mac ... 40/arduino). Simple copy/paste; no edit. I cannot get past verification, so I know its something in the code, just not sure what.
I'm probably missing something simple, but I've tried everything I could think of. I have tried reverting the version of the NeoPixel library back to 1.8.1 as shown in the article. I've uninstalled and reinstalled the library, restarted the IDE and my computer. I've pasted the entire error message below and the example code is available at the link above.
Arduino: 1.8.16 (Windows 10), Board: "Raspberry Pi Pico, 2MB (no FS), 125 MHz, Small (-Os) (standard), Disabled, Disabled, None, Pico SDK"
MacroPad_RP2040_example:7:46: error: 'NUM_NEOPIXEL' was not declared in this scope
7 | Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_NEOPIXEL, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
| ^~~~~~~~~~~~
MacroPad_RP2040_example:7:60: error: 'PIN_NEOPIXEL' was not declared in this scope
7 | Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_NEOPIXEL, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
| ^~~~~~~~~~~~
MacroPad_RP2040_example:10:61: error: 'OLED_DC' was not declared in this scope
10 | Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &SPI1, OLED_DC, OLED_RST, OLED_CS);
| ^~~~~~~
MacroPad_RP2040_example:10:70: error: 'OLED_RST' was not declared in this scope
10 | Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &SPI1, OLED_DC, OLED_RST, OLED_CS);
| ^~~~~~~~
MacroPad_RP2040_example:10:80: error: 'OLED_CS' was not declared in this scope
10 | Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &SPI1, OLED_DC, OLED_RST, OLED_CS);
| ^~~~~~~
MacroPad_RP2040_example:13:23: error: 'PIN_ROTA' was not declared in this scope
13 | RotaryEncoder encoder(PIN_ROTA, PIN_ROTB, RotaryEncoder::LatchMode::FOUR3);
| ^~~~~~~~
MacroPad_RP2040_example:13:33: error: 'PIN_ROTB' was not declared in this scope
13 | RotaryEncoder encoder(PIN_ROTA, PIN_ROTB, RotaryEncoder::LatchMode::FOUR3);
| ^~~~~~~~
C:\Users\brentw\Documents\Arduino\MacroPad_RP2040_example\MacroPad_RP2040_example.ino: In function 'void setup()':
MacroPad_RP2040_example:42:11: error: 'PIN_ROTA' was not declared in this scope
42 | pinMode(PIN_ROTA, INPUT_PULLUP);
| ^~~~~~~~
MacroPad_RP2040_example:43:11: error: 'PIN_ROTB' was not declared in this scope
43 | pinMode(PIN_ROTB, INPUT_PULLUP);
| ^~~~~~~~
MacroPad_RP2040_example:55:11: error: 'PIN_SPEAKER' was not declared in this scope
55 | pinMode(PIN_SPEAKER, OUTPUT);
| ^~~~~~~~~~~
C:\Users\brentw\Documents\Arduino\MacroPad_RP2040_example\MacroPad_RP2040_example.ino: In function 'void loop()':
MacroPad_RP2040_example:111:20: error: 'PIN_SWITCH' was not declared in this scope
111 | if (!digitalRead(PIN_SWITCH)) {
| ^~~~~~~~~~
exit status 1
'NUM_NEOPIXEL' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"NUM_NEOPIXEL" is not declared in this scope
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- brentwipf
- Posts: 1
- Joined: Sat Apr 24, 2021 3:03 pm
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: "NUM_NEOPIXEL" is not declared in this scope
It's because you have the board set to "Raspberry Pi Pico". The Board Support Package for the Pico board does not declare the constant NUM_NEOPIXEL. Select "Adafruit MacroPad RP2040" as your board..
Dave
Dave
Please be positive and constructive with your questions and comments.