I finally got it hooked up and working. Took way longer than I would like to admit.
Code is here...
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define LEDSPERSEGMENT 4
Adafruit_NeoPixel strip = Adafruit_NeoPixel(56, PIN, NEO_GRB + NEO_KHZ800);
uint32_t color = strip.Color(40, 0, 0);
int number = 0; //the number to show on the display
int oldNumber=1;
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel’s data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit…if you must, connect GND first.
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
Serial.begin(57600);
Serial.println(“Starting…”);
}
unsigned char offset1[] = {3,4,6,0,1,2,5}; //segment1 offset
unsigned char offset2[] = {2,3,5,6,0,1,4}; //segment2 offset
unsigned char segments1[][7] = {{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,0,0},{1,1,1,1,1,1,1},{1,1,1,0,0,1,1}};
unsigned char segments2[][7] = {{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,0,0},{1,1,1,1,1,1,1},{1,1,1,0,0,1,1}};
void loop()
{
while(Serial.available())
{
String text = Serial.readStringUntil(‘M’);
if(text.length()>32)
{
char index = text.indexOf(’,’);
char index2 = text.indexOf(’,’,index+1);
text = text.substring(index+1,index2);
number = abs(text.toInt());
if(oldNumber!=number)
{
oldNumber=number;
showNumber();
}
}
}
}
void showNumber()
{
for(int i=0;i<LEDSPERSEGMENT72;i++)
strip.setPixelColor(i,strip.Color(0,0,0));
strip.show();
if(number>9)
{
for(int i=0;i<7;i++) //for all segments in a number
{
if(segments1[number/10][i]==1) //if the segment should light up
{
for(int j=0;j<LEDSPERSEGMENT;j++)
strip.setPixelColor((offset1[i]*LEDSPERSEGMENT)+j, color);
}
}
}
for(int i=0;i<7;i++) //for all segments in a number
{
if(segments2[number%10][i]==1) //if the segment should light up
{
for(int j=0;j<LEDSPERSEGMENT;j++)
strip.setPixelColor((offset2[i]*LEDSPERSEGMENT)+j+28, color);
}
}
strip.show();
}