Go Down

Topic: Serial Communication and writing to TLC (Read 628 times) previous topic - next topic


Hello All,

My first time posting to this forum. I have a question about writing to the TLC from Processing via serial. I'm reading Kinect data on the Processing side and trying to send the output to my TLC chips. The problem is that it is a 3-dimensional array and I don't know how to signal the chip to push out bits. Here's what my code looks like:


*** a bunch of depth data processing
*** handshaking methods
*** when Processing gets the signal that it can send bytes I do this:

Code: [Select]
// update the array, send it
    for (int y = 0; y < 8; y++) {
      for (int z = 0; z < 8; z++) {
        for (int x = 0; x < 8; x++) {

When I print this output to the console I get a bunch of zeroes while my program loads (as expected), then around the 30th cycle or so I get stuff like this:

counter = 28

I think that's right, because if I understand correctly the numbers correspond to a location of the 3-dimensional array.

Then on the Arduino side I'm doing this:


Code: [Select]
if (Serial.available() >= 8) {

    //********** TLC STUFF **********
    for (int y = 0; y < 8; y++){
      for (int z = 0; z < 8; z++) {
        for (int x = 0; x < 8; x++) {
          bytes[y][z][x] = Serial.read();

          int LEDbrightness = map(y, 0, 8, 0, 4095);

          Tlc.set(x, LEDbrightness);

          digitalWrite(analogPin[y], LOW);
          digitalWrite(analogPin[y], HIGH);

And this is where I'm hitting a wall. How can I tell Tlc.set() which channel to send the information to, since it's coming in a different from from Processing?

To clarify, I've got 4 Tlc's daisy chained for 64 outputs. So in order to switch between the 64-pixel layers, I'm cycling through 8 Analog pins. The process is something like, "Hold layer LOW, shift out 64 bits, return layer HIGH to turn off LEDs. Switch to next layer, hold it LOW, shift out 64, and so on." I don't know how to translate the data coming into Arduino from Processing to talk to my chips in the way the function Tlc.set() is set up.

How can I do this? Help would be hugely appreciated!!!!

Go Up