i have some TM1804 (3 RGB LEDs per controller/per 10cm piece) addressable strip, which i've been playing with and got working with the various libraries for neopixel and fastled, im curious to know how i can set a repeating static colour pattern on it, say for example red on 3 pieces, blue on another 3 pieces and green on the next 3 pieces, repeating over the whole 5m strip and static, so not moving at all?
Like this:
|RRR|RRR|RRR|GGG|GGG|GGG|BBB|BBB|BBB|
with each '|' being the break between the 3 leds and a TM1804 controller for the 3.
Here is some psudo code to get you going. It shows you the structure of what you need to do.
Have a go at writing this into a proper program. As it is only to be done once put this in the start up function. Add the calls to your library to set the LEDs and display them as shown.
If you have no success then post the code you have tried and ask for advice in getting it working. Do not post code without code tags, that is the icon to the left of the quite icon.
// set up an array of colours
unsigned long colour[] = { ..... , ......, ......., ........ }
// numbers for black, red, green, blue
int colourCount = 0
for(int LED = 0; LED<numberOfLEDs; LED+=4){// step through your LEDs in steps of four
setCol(LED,colour[colourCount]);
coulorCount ++;
if ( colourCount > 3) colourCount=0
}
// display the LEDs
......
// rest of the code
// add this function
void setCol(number, colour)
// set LED 'number' to colour[0]
for(int i =1; i<3; i++){
// set LED number + 1 to colour
}