Go Down

Topic: Xport (Read 377 times) previous topic - next topic

gokce

Hi,
I am using Xport and Sparkfun RGB Led Matrix for my project. They both work great individually. However, when I combine the codes xport doesn't work.

My Xport code is based on the Tom Igoe's code and Hernando Barragan's USB weatherboard code. RGB led matrix code is based on the halfmachine.dk code.

Here some of the code:
Code: [Select]
void setup() {
 // Xport setup
 pinMode(deviceResetPin, OUTPUT);
 pinMode(ledPin, OUTPUT);
 Serial1.begin(57600);
 resetDevice();

 //RGB Matrix setup
 matrixInit();

 // Diagnostics
 Serial.begin(57600);
 Serial.println("Setup");
 //arrayDiagnostic();
}

void loop() {
 // Xport loop
 stateCheck();

 // RGB Matrix loop
 //arrayRandom();
 writeMatrix();
}


Xport only gets two characters and prints D (which means disconnected).

Altough, when I comment out the writeMatrix function from the void loop(), Xport works. Is it the delays in the writeMatrix() which causes the problem? Delay in a function is affecting working speed of an another function?


Here is the writeMatrix function:
Code: [Select]
{
 for(int display = 0;display <12;display++)
 {
   digitalWrite(clock, LOW);    //sets the clock for each display, running through 0 then 1
   digitalWrite(data, LOW);    //ditto for data.

   delayMicroseconds(10);
   digitalWrite(cs[display], LOW);     //ditto for cs.
   delayMicroseconds(10);
   for(int x = 0; x < 8;x++)
   {
     for (int y = 0 ; y < 8;y++)
     {
       writeByte(displayPicture[display][x][y], display); //Drawing the grid. x across then down to next y then x across.
       delayMicroseconds(10);
     }
   }
   delayMicroseconds(10);
   digitalWrite(cs[display], HIGH);
 }
}


I am stuck, I could post more of the code if it will be helpful,
Gokce

Go Up