0

RP2040 Neopixel
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RP2040 Neopixel

by StressedDave on Sat Sep 18, 2021 6:20 am

I'm using Earl's Arduino core on the RP2040 Feather. The pin definition has no value for PIN_NEOPIXEL but the schematic says it's on pin 27, so my 'Hello World, Neopixel edition' code reads:
Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>
#include <rp2040_pio.h>

Adafruit_NeoPixel pixel(1,27, NEO_GRB + NEO_KHZ800);

void setup() {
  // put your setup code here, to run once:
  pinMode(PIN_LED,OUTPUT);
  digitalWrite(PIN_LED,HIGH);
  pixel.begin();
  pixel.show();
  pixel.setBrightness(20);
  pixel.setPixelColor(0, pixel.Color(200, 95, 31));
  pixel.show();
  delay(1000);
}

void tardis(){
  float in;
  uint8_t out;
for (in = 0; in < 6.282; in = in + 0.002)
  {
    out = int(sin(in) * 127.5 + 127.5);
    pixel.setPixelColor(0, pixel.Color(0, 0, out));
    pixel.show();
  }
}
void loop() {
  tardis(); 
}

}


The inbuilt LED lights, but nada on the Neopixel.

My RP2040 Trinkey lights the Neopixel although the schematic shows a different pin to the Feather.

Am I doing something wrong?

StressedDave
 
Posts: 4
Joined: Tue Mar 02, 2021 5:17 pm

Re: RP2040 Neopixel

by mikeysklar on Sat Sep 18, 2021 7:00 pm

Try using pin 16 or board.NEOPIXEL.

B89B4958-D6A9-4046-83F9-60B4E5515073.jpeg
B89B4958-D6A9-4046-83F9-60B4E5515073.jpeg (1.26 MiB) Viewed 22 times

mikeysklar
 
Posts: 5813
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 Neopixel

by StressedDave on Sun Sep 19, 2021 2:09 am

Pin 16 works... should have looked closer at that diagram (and realised that pin mapping matched GPIO numbers not chip pins). Cheers

StressedDave
 
Posts: 4
Joined: Tue Mar 02, 2021 5:17 pm

Re: RP2040 Neopixel

by mikeysklar on Sun Sep 19, 2021 1:43 pm

Glad that worked. Just curious does board.NEOPIXEL also work? It should also be defined. I also tend to mix up the GPIO pin numbering.

mikeysklar
 
Posts: 5813
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.