Code:
#include <WS2812Serial.h>
#include <Arduino.h>
const int numled = 12;
const int pin = 24;
DMAMEM byte displayMemory[numled*12]; // 12 bytes per LED
byte drawingMemory[numled*3]; // 3 bytes per LED
WS2812Serial leds = WS2812Serial(numled, displayMemory, drawingMemory, pin, WS2812_GRB);
void setup()
{
leds.begin();
Serial.begin(9600);
}
void loop()
{
Serial.print("looping");
while (usbMIDI.read()) {
}
}
Curiously, this seems to run fine if compiled using the Arduino IDE, but not when using VSCode (PlatformIO). I'm fairly perplexed as it's about as easy as it gets. If I pull out leds.begin(), I see the Serial.print() fine in VSCode. Not sure what's going on. If I had to guess, I'm guessing there's some environment variables that need to be set in the platformio.ini file.