LED strip -> LED matrix

Hello!
I describe what I want to do.

I have LED strip, LPD6803 based.
Got them working with fastspi library.
Now I want to make that strip like a screen. 10x5 pixels.
I need to send coordinates with color and Arduino should translate it to correct SPI signal.
I was thinking of using vvvv to send data to Arduino.

I think I should send this data as an array. Every array is one frame.
Should that work?
And I can't figure out the code to Arduino.
I tried some "for" cycles, but it's not friendly to me...

I think I should send this data as an array.

There is no need for this.
You need to send your data in the same order as you have your LEDs connected electrically to minimise the processing the arduino has to do.
Ideally you send a stream of data and the arduino just programs the next one in the list as it comes in.
You can use a look up table (an array) to convert between the data position and the LED address if you need to but it shouldn't be necessary if you arrange things right.

Grumpy_Mike:
You need to send your data in the same order as you have your LEDs connected electrically to minimise the processing the arduino has to do.
Ideally you send a stream of data and the arduino just programs the next one in the list as it comes in.

I see the point here.
But if I have 1 frame, I need many LEDs ON at the same time not one after the other.

fastspi code to turn ON LED:

Display[number_of_that_led_in_a_strip] = Color(r,g,b)

I want to input something like:

x,y,r,g,b

If I am constantly sending data stream, should I see many LEDs on at the same time? Are they just flickering very fast?

When you do this:-
Display[number_of_that_led_in_a_strip] = Color(r,g,b)
to two LEDs they are both on at the same time aren’t they?
So your only problem is converting the X & Y into the appropriate number_of_that_led_in_a_strip value.
If you don’t need random access to the LEDs so it is best to just order your data so all you need to do is increment the number_of_that_led_in_a_strip value for the next byte you send.

If you can’t get your head around that then use a look up table:-

Display[lookUp[x][y]] = Color(r,g,b)

Where the array lookUp contains the appropriate value for each coordinate.
(but you should be able to arrange things so you don’t have to send x & y)

As I understand, lookup table takes much space in code, right?
I am thinking now, what would be the easiest way to make different color chases with the strip.

One idea: Maybe I can use virtual dimmer somehow. I make one chase and then I can choose different colors for it. Then I don't need to make the same chase for every color I want.

lookup table takes much space in code, right?

In this case it will take one byte for every LED you have so it's not very big. However as I said you don't have to have an array.

I make one chase and then I can choose different colors for it.

Well you are changing what you are asking here. This is programming in a pattern algorithmically. Yes you can have one function to do this and pass that function the R, G and B colour value you want to do it with and use those passed in values to set the LEDs. So the one function will work in all colours.

That chip / library uses an unsigned int which is 2 bytes per color. I suggest streaming the entire LED matrix frame with a start and stop indicator. Even though you can send the data in 2 bytes you could send in three bytes to make your logic easier. The color values are 0 to 31 with that chip / library.

On the Arduino ..
So the receive process could go like this ..

If the data value is 34 that means start frame - so set position to 0.
else
if the data value is 35 then that means end frame - so use the buffered 150 bytes to set the values via the fast spi library.
else
read in the data and set the value received in the buffer at the current position and add 1 to the current position

On the PC ..
The send process would send a start frame command then stream one byte per color, three bytes per led in order RGBRGBRGB until end of frame data - then send the stop command.

Summary:
That is my suggested approach if you want to stream a 50 LED matrix from a computer.

To make this happen I suggest you do this.

Create an arduino application with a 150 byte buffer, load the data using hard coded values and then create a function to refresh the LED based on that array of data.

Next I would create a simple serial program using the examples provided and assure you can send the data.

Next combine the apps to have the data load the buffer array and then refresh the matrix.

Hope that helps.

marklar's approach (which is the same as Grumpy_Mike's approach, just spelled out in explicit detail for you) will work fine. I used a very similar approach at Maker Faire to control 128 RGB pixels in a ceiling, each with 24 bit color. I was able to do 30Hz updates just using a 115200 serial link from a Processing application.