look here in loop():
void loop() {
// put your main code here, to run repeatedly:
ledStrip.write(colors, LED_COUNT); //If this line is commented out, the program runs as expected
recvWithStartEndMarkers();
printNewData();
}
you are CONSTANTLY writing the array to the strip...
the function 1) blocks and 2) disables interrupts. So, interrupts are largely disabled all of the time.
you have to change the logic to update the strip if and only if arduino receives new values.
EDIT:
Example below eliminates this nonsense:
recvWithStartEndMarkers();
printNewData();
in favor of a function that will tell you that you've received something (basically conditionally calling both the printNewData() function and the write to the ledStrip). I've re-factored your recvWithStartEndMarkers() function as you don't need start and end markers for Serial transmission. This code only needs a newline character (i.e. '\n' in the code that follows). So, rather than bracketing your data in those sideways carats (<>) just send the data with a newline behind it. Or, as you can see from the function, select any char to end the message.
#include <PololuLedStrip.h>
#define MAX_MESSAGE_LENGTH 32
PololuLedStrip<12> ledStrip;
#define LED_COUNT 576
rgb_color colors[LED_COUNT];
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println(F("Doing something"));
}
void loop()
{
if(char* newMessage = checkForNewMessage(Serial, '\n'))
{
Serial.println(newMessage);
// De-Code your message here, then write to the ledStrip
ledStrip.write(colors, LED_COUNT); //If this line is commented out, the program runs as expected
}
}
const char* checkForNewMessage(Stream& stream, const char endMarker)
{
static char incomingMessage[MAX_MESSAGE_LENGTH] = "";
static byte idx = 0;
if(stream.available())
{
incomingMessage[idx] = stream.read();
if(incomingMessage[idx] == endMarker)
{
incomingMessage[idx] = '\0';
idx = 0;
return incomingMessage;
}
else
{
idx++;
if(idx > MAX_MESSAGE_LENGTH - 1)
{
//stream.print(F("{\"error\":\"message too long\"}\n")); //you can send an error to sender here
idx = 0;
incomingMessage[idx] = '\0';
}
}
}
return NULL;
}
I'll leave it to you to parse the message...