2x Arduino Uno R3 (We'll call them Arduino1 and Arduino2)
2x SainSmart XBee Shield
2x XBee Pro Series 1 60mw
2x 75mm Bars - 12V Digital RGB LED Pixels
As of right now I have Vixen3 lighting software on one computer through USB controlling one strand of the pixels on Pins 2 and 3 on Arduino1 with no problems. I am having trouble sending the data from Arduino1 to Arduino2 with the XBee to recreate what is happening on Arduino1 without having to use another computer. I have posted the code that I am using to control the LEDs on Arduino1, most of the code is borrowed. I really could use some help on this one because my head hurts from banging it against the wall.
Code: Select all
#include "Adafruit_WS2801.h"
#include "SPI.h"
#define DPIN 2
#define CPIN 3
int PixelCount = 21;
int bugLevel = 0;
Adafruit_WS2801 strip = Adafruit_WS2801(21, DPIN, CPIN);
void setup()
{
delay(100);
strip.begin();
strip.show();
Serial.begin(115200);
}
void loop()
{
if (Serial.available()>2)
{
waitForVixenHeader();
for (int pixCount=0; pixCount<PixelCount;pixCount++)
{
int RGB[3];
for (int color = 0;color<3;color++)
{
while (Serial.available() < 1)
{
delay(10);
}
RGB[color] = Serial.read();
}
strip.setPixelColor(pixCount,RGB[0],RGB[1],RGB[2]);
}
strip.show();
}
}
void waitForVixenHeader()
{
char *header="VIXStart";
char buffer[3];
int index = 0;
while (true)
{
int inByte = Serial.read();
if(inByte==-1)
{
continue;
}
buffer[index] = inByte;
if(buffer[index]!=header[index])
{
index=-1;
}
buffer[index+1] = 0;
index++;
if(index==8)
{
return;
}
}
}