In a previous post I showed you the code for getting the Octows2811 library to display scrolling text. That code just had a basic colour set into it to get the thing working as a basic test. If you want to control the colour of the text that is being used you can easily change it. Once you implement a small additional piece of code, you can use whatever colour you want.
To do this, you need to use a helper function. This function turns making a colour into as simple as colour = Color( set of values for RGB). This is used in many of the libraries out there, but I thought that I would put it here for usefulness.
So, first thing to do is add in the helper function that the method will refer to:
//——- HELPER FUNCTION——//
// Create a 24 bit color value from Red,Green and Blue ////
unsigned int Color(byte r, byte g, byte b)
//Take the lowest 8 bits of each value and append them end to end
return( ((unsigned int)g & 0x1F )<<16 | ((unsigned int)b & 0x1F)<<8 | (unsigned int)r & 0x1F);} /////////////////// once you put this into your sketch ( i usually put it at the end), you can then reference it. The key here is the definition of what the function is, being "Color(byte,byte,byte)". When you want to use a colour in this scrolling text sketch, you firstly need to define a colour. You can do this by placing this line in the sketch: int Colour1 = Color(random(1,100),random(1,100),random(1,100)); This piece of code changes the colour of the text to a new 'random' colour each time it starts. you could put in int Colour1 = Color(100, 50, 2); I can't remember if the colours are BRG for ws2811 or RGB. but a simple test is to do something like: int Colour2 = Color(100,0,0); and seeing what it comes out as, and then moving the high value to the next position, and seeing what colour the LEDs change to. Then, change the line: leds.setPixel(pix[row], isOn*50); to leds.setPixel(pix[row], isOn*Colour1); hope that this is of use mortonkopf