// Program written for Dan to test colours of his HL1606 light strip // This should give a sequence of colours starting with White followed by Red, Green, Blue followed by a random mixture #include #define SIPIN 9 #define DIPIN 1 #define CLKPIN 10 #define LATCHPIN 3 LEDStrip mystrip(DIPIN,SIPIN,LATCHPIN,CLKPIN); #define SPULSES 5000 #define STRIP_LENGTH 64 long randNumber; void setup() { ClearStrip(100); randomSeed(analogRead(0)); } void loop() { ClearStrip(1000); PatternA(50); // This should give a sequence of colours starting with White followed by Red, Green, Blue // Add // if you want to comment out the next line if you want random colourrs RandomStrip(); } void latchanddelay(int dur) { mystrip.latch(); delay(dur); } void ClearStrip(int duration) { int x; for(x=0;x0) mystrip.pushCmd(Cmd); } void RandomPush(int Cnt) { while(Cnt-->0) RandomColour(); } void PatternA(int duration) { // Sample program to test which LED is which Colour // Only uncomment one of the following 3 lines at a time MultiPush(149,64); //This should turn on All LEDs (White) latchanddelay(3000); ClearStrip(1000); MultiPush(132,64); //This should turn on just the Red LED (LED2) latchanddelay(3000); ClearStrip(1000); MultiPush(144,64); //This should turn on just the Green LED (LED3) latchanddelay(3000); ClearStrip(1000); MultiPush(129,64); //This should turn on just the Blue LED (LED1) latchanddelay(3000); ClearStrip(1000); } void RandomStrip() { RandomPush(64); latchanddelay(50); } char RandomColour() { char colour=128; randNumber= random(7); if(randNumber & B00000001) colour|=B00000001; if(randNumber & B00000010) colour|=B00000100; if(randNumber & B00000100) colour|=B00010000; return colour; }