Hi All, i have some 1903 RGB strip , 9 LED's long, and i would like to address each LED colour individually, i,e, set LED 1 to orange, 3 to red, 4 to greet etc
I have some experience with the TLC5490 but these are a different kettle of fish, i have a Fast Spi library i discovered on the net, but the keywords dont seem to reference to this particular chip
I have this so far
#include "FastSPI_LED2.h"
#define NUM_LEDS 4
struct CRGB { byte r; byte b; byte g; };
struct CRGB leds[NUM_LEDS];
UCS1903Controller400Mhz<3> LED; // Sets the Controller to be UCS1903
void setup()
{
LED.init(); //Initialise LED Controller
}
void loop() {
for(int i = 0; i < 3; i++) {
for(int iLed = 0; iLed < NUM_LEDS; iLed++) {
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
switch(i) {
case 0: leds[iLed].r = 255; break;
case 1: leds[iLed].g = 255; break;
case 2: leds[iLed].b = 255; break;
}
LED.showRGB((byte*)leds, NUM_LEDS);;
delay(100);
}
}
}
This is an expample provided which just runs the led's through each of the 3 colours continuousle, but i simple want to write a value and send it, sorry i cant offer more insight
The testLeds_2 folder actually contains support for the UCS1903 so i have it working on the bench and changing colour, but i dont understand the example code as i posted above,
The TLC5490 was simple, LED.Set and LED.update were simple commands, but i dont understand the commands used to set the data, the layout of the data its expecting to see, and the command to update the data in the chip?
Im not an experienced programmer and ive been racking my brains for hours trying different keywords in the list to get it to do a simple "set Led 1 red" for example
Ok, you're talking a completely different library then. The FastSPI library that most everyone here uses does not contain any testleds_2 folder, nor LED.set or LED.update commands. Where did you get it from?
This is the site i got the code from, it works fine with the 1903 strip, i just cant get my head around the commands used in the examples there
If i simply wanted to set led 1 to Red for example, what is the simpilest way to do it, once i understand the basic principals of using the keywords i will be fine i think
The FastSPI_LED library, both versions, expect you to work with an array of led data - vs. other libraries that have a set function that's used to set a specific led. Direct array access is far more efficient than having function calls required to set/get led values, among other things.
So, to set the 3'd led to red you would do something like leds[2].r=255; leds[2].g=0; leds[2].b=0;
I'm tossing around some ideas for making it so that both sets of options are available to people to use - method based access for people who want something simpler to understand out of the box, but direct data access for people who are concerned about performance/speed.
Thanks for that Garcia, i understand what it does but at the moment i am a little bit behind on the coding, the library i found on Github works great and usues simple functions to call, similar to what you have mentioned about the array, but works in the way led.set("led number" "red value" "green value" "blue value")