So my project has progressed following the previous help you offered, particularly electronically. There's one sticking point I can't figure out that I'd very much appreciate a suggestion on. I can't work out how to make a function look up the values of the pixel arrays using the variable 'personsname'. The following code is a very stripped back version to highlight the exact problem area...
#include "SPI.h"
#include "Adafruit_WS2801.h"
//DEFINE OUTPUT PINS
int dataPin = 2; //Yellow wire
int clockPin = 3; //Green wire
//SET NUMBER OF PIXELS
Adafruit_WS2801 strip = Adafruit_WS2801(20, dataPin, clockPin);
//PIXEL ARRAYS
byte Pete[] = { 0, 19, 43, 63};
byte Stephen[] = { 25, 32, 37, 59, 60, 63, 71};
byte Jack[] = { 20, 59, 61, 68};
//SETUP
void setup(){
strip.begin();
strip.show();
Serial.begin(9600);
}
//CHECK & UPDATE LOOP
void loop(){
colorFade(Color(0, 0, 255), "Pete");
}
delay(10000); //wait 10 seconds before connecting again
}
// MAIN FUNCTIONS
//Fade to color
void colorFade(uint32_t c, char* personsname) {
int i, j;
for (c=0; c < 256; c++) {
for (i=0; i < sizeof(personsname); i++) { //Can't get this to work. I can't figure out how to make the function look up the values of the pixel array using the variable 'personsname'. It works if a name is entered directly instead of "personsname", e.g. "Jack" will light up the correct LEDs.
strip.setPixelColor(personsname[i], c); //Same here.
}
strip.show(); // write all the pixels out
delay(50);
Serial.print("Fade In: ");Serial.print(personsname);Serial.println("");
}
}
Any tips gratefully received. Thanks