8x8 led display word from pc monitor

String comdata="";
int speed = 80; //number of times to repeat each frame
int pauseDelay = 500; 
//microseconds to leave each row  on before moving to the next
  //The string to display
                                           //to change the message in code you right yourself simply 
                                           //change this data and reset index and offset to 0
//Variables used for scrolling (both start at 0
int index = 0;  //this is the current charachter in the string being displayed
int offset = 0; //this is how many columns it is offset by

//Pin Definitions
int rowA[] = {36, 37, 34, 35, 32, 33, 30, 31};          //An Array defining which pin each row is attached to
                                         //(rows are common anode (drive HIGH))
int colA[] = {40, 41, 38, 39, 51, 50, 52, 53};  //An Array defining which pin each column is attached to
                                         //(columns are common cathode (drive LOW))

//Constants defining each charachters position in an array of integer arrays
//Letters
const int A = 0;  const int B = 1;  const int C = 2;  const int D = 3;  const int E = 4;
const int F = 5;  const int G = 6;  const int H = 7;  const int I = 8;  const int J = 9;  
const int K = 10; const int L =11;  const int M = 12; const int N = 13; const int O = 14; 
const int P = 15; const int Q =16;  const int R = 17; const int S = 18; const int T = 19; 
const int U = 20; const int V =21;  const int W = 22; const int X = 23; const int Y = 24; 
const int Z = 25; const int num1 = 37; int num2 = 38; int num3 = 39; int num4 = 40; int num5 = 41; int num6 = 42;
int num17 = 43; int num8 = 44; int num9 = 45; int num0 = 46;

//Punctuation
const int COL =26; const int DASH = 27; const int BRA2 = 28; const int  _ = 29; const int LINE = 34;
const int DOT =36;

//Extra Charchters
const int  FULL =30; const int CHECK = 31; const int B2 = 32; const int TEMP = 33; 
const int SMILE =35; const int COLDOT = 36; 


//The array used to hold a bitmap of the display 
//(if you wish to do something other than scrolling marque change the data in this
//variable then display)
byte data[] = {0,0,0,0,0,0,0,0};        

//The alphabet
//Each Charachter is an 8 x 7 bitmap where 1 is on and 0 if off
const int _A[] = {B0001000,
                  B0010100,
                  B0100010,
                  B1000001,
                  B1111111,
                  B1000001,
                  B1000001,
                  B0000000};

const int _B[] = {B1111110,
                  B0100001,
                  B0100001,
                  B0111110,
                  B0100001,
                  B0100001,
                  B1111110,
                       B0000000};

const int _C[] = {B0011111,
                  B0100000,
                  B1000000,
                  B1000000,
                  B1000000,
                  B0100000,
                  B0011111,
                       B0000000};

const int _D[] = {B1111100,
                  B0100010,
                  B0100001,
                  B0100001,
                  B0100001,
                  B0100010,
                  B1111100,
                       B0000000};

const int _E[] = {B1111111,
                  B1000000,
                  B1000000,
                  B1111100,
                  B1000000,
                  B1000000,
                  B1111111,
                       B0000000};

const int _F[] = {B1111111,
                  B1000000,
                  B1000000,
                  B1111100,
                  B1000000,
                  B1000000,
                  B1000000,
                       B0000000};

const int _G[] = {B0011111,
                  B0100000,
                  B1000000,
                  B1001111,
                  B1000001,
                  B0100001,
                  B0011111,
                       B0000000};
 const int _H[] = {B1000001,
                  B1000001,
                  B1000001,
                  B1111111,
                  B1000001,
                  B1000001,
                  B1000001,
                       B0000000};



const int _I[] = {B1111111,
                  B0001000,
                  B0001000,
                  B0001000,
                  B0001000,
                  B0001000,
                  B1111111,
                       B0000000};

const int _J[] = {B0001111,
                  B0000001,
                  B0000001,
                  B0000001,
                  B0000001,
                  B1000001,
                  B0111110,
                       B0000000};

const int _K[] = {B1000011,
                  B1000100,
                  B1001000,
                  B1110000,
                  B1001000,
                  B1000100,
                  B1000011,
                       B0000000};

const int _L[] = {B1000000,
                  B1000000,
                  B1000000,
                  B1000000,
                  B1000000,
                  B1000000,
                  B1111111,
                       B0000000};

const int _M[] = {B1110110,
                  B1001001,
                  B1001001,
                  B1001001,
                  B1001001,
                  B1001001,
                  B1001001,
                       B0000000};

const int _N[] = {B1000001,
                  B1100001,
                  B1010001,
                  B1001001,
                  B1000101,
                  B1000011,
                  B1000001,
                       B0000000};

const int _O[] = {B0011100,
                  B0100010,
                  B1000001,
                  B1001001,
                  B1000001,
                  B0100010,
                  B0011100,
                       B0000000};

const int _P[] = {B1111110,
                  B0100001,
                  B0100001,
                  B0111110,
                  B0100000,
                  B0100000,
                  B0100000,
                       B0000000};

const int _Q[] = {B0011100,
                  B0100010,
                  B1000001,
                  B1000001,
                  B1000101,
                  B0100010,
                  B0011101,
                       B0000000};

const int _R[] = {B1111110,
                  B0100001,
                  B0100001,
                  B0101110,
                  B0100100,
                  B0100010,
                  B0100001,
                       B0000000};

const int _S[] = {B0111111,
                  B1000000,
                  B1000000,
                  B0111110,
                  B0000001,
                  B0000001,
                  B1111110,
                       B0000000};

const int _T[] = {B1111111,
                  B0001000,
                  B0001000,
                  B0001000,
                  B0001000,
                  B0001000,
                  B0001000,
                       B0000000};

const int _U[] = {B1000001,
                  B1000001,
                  B1000001,
                  B1000001,
                  B1000001,
                  B1000001,
                  B0111110,
                       B0000000};

const int _V[] = {B1000001,
                  B1000001,
                  B1000001,
                  B1000001,
                  B0100010,
                  B0010100,
                  B0001000,
                       B0000000};
                  
const int _W[] = {B1000001,
                  B1001001,
                  B1001001,
                  B1001001,
                  B1001001,
                  B1001001,
                  B0110110,
                       B0000000};

const int _X[] = {B1000001,
                  B0100010,
                  B0010100,
                  B0001000,
                  B0010100,
                  B0100010,
                  B1000001,
                       B0000000};

const int _Y[] = {B1000001,
                  B0100010,
                  B0010100,
                  B0001000,
                  B0001000,
                  B0001000,
                  B0001000,
                       B0000000};

Here the problem is when i input the text into the monitor, the LED matrix cannot diplay the word. thank you

part2

const int _Z[] = {B1111111,
                  B0000010,
                  B0000100,
                  B0111110,
                  B0010000,
                  B0100000,
                  B1111111,
                       B0000000};

const int _COL[] = {B0000000,
                  B0011000,
                  B0011000,
                  B0000000,
                  B0011000,
                  B0011000,
                  B0000000,
                       B0000000};

const int _DASH[] = {B0000000,
                  B0000000,
                  B0000000,
                  B0111110,
                  B0000000,
                  B0000000,
                  B0000000,
                       B0000000};

const int _BRA2[] = {B0010000,
                  B0001000,
                  B0000100,
                  B0000100,
                  B0001000,
                  B0010000,
                  B0000000,
                       B0000000};                  

const int __[] = {B0000000,
                  B0000000,
                  B0000000,
                  B0000000,
                  B0000000,
                  B0000000,
                  B0000000,
                 B0000000};

const int _FULL[] = {B00000000,
                     B00000000,
                     B00000000,
                     B00000000,
                     B00000000,
                     B00000000,
                     B00000000,
                       B00000000};                  

const int _CHECK[] = {B1010101,
                     B0101010,
                     B1010101,
                     B0101010,
                     B1010101,
                     B0101010,
                     B1010101,
                       B0000000};
                  
const int _B2[] = {B0111110,
                   B0000001,
                   B0000001,
                   B0001111,
                   B0000001,
                   B1000001,
                   B0111110,
                       B0000000};

const int _TEMP[] = {B0000011,
                     B0011111,
                     B0111111,
                     B1111110,
                     B1111111,
                     B0011111,
                     B0000011,
                       B0000000};

const int _LINE[] = {B0000001,
                     B0000001,
                     B0000001,
                     B0000001,
                     B0000001,
                     B0000001,
                     B0000001,
                       B0000000};                     
                 
const int _SMILE[] = {B000000,
                      B1100100,
                      B1100010,
                      B0011001,
                      B1100010,
                      B1100100,
                      B0000000,
                      B0000000};                     
                  

const int _DOT[] = {B0000000,
                  B0000000,
                  B0000000,
                  B0000000,
                  B1100000,
                  B1100000,
                  B0000000,
                  B0000000};                     
                  
const int _COLDOT[] = {B0000000,
                       B0110000,
                       B0110000,
                       B0000000,
                       B0110011,
                       B0110011,
                       B0000000,
                       B0000000};  
const int _num1[] = {B0000010,
                  B0000110,
                  B0001010,
                  B0010010,
                  B0000010,
                  B0000010,
                  B1111111,
                 B0000000};
const int _num2[] = {B0001100,
                  B0010010,
                  B0100100,
                  B0001000,
                  B0010010,
                  B0100000,
                  B1111111,
                 B0000000};
const int _num3[] = {B1111000,
                  B1000100,
                  B0001000,
                  B0010000,
                  B0001000,
                  B0000100,
                  B0111000,
                 B0000000};
const int _num4[] = {B0000010,
                  B0001110,
                  B0001010,
                  B0010010,
                  B0100010,
                  B1000010,
                  B1111111,
                 B0000010};    
const int _num5[] = {B1111100,
                  B1000000,
                  B0110000,
                  B0001000,
                  B0000100,
                  B0000100,
                  B0111000,
                 B0000000};
const int _num6[] = {B1111111,
                  B0000001,
                  B0000001,
                  B1111111,
                  B1000001,
                  B1000001,
                  B1111111,
                 B0000000};
const int _num7[] = {B1111111,
                  B0000010,
                  B0000100,
                  B0001000,
                  B0010000,
                  B0100000,
                  B1000000,
                 B0000000};
const int _num8[] = {B1111111,
                  B1000001,
                  B1000001,
                  B1111111,
                  B1000001,
                  B1000001,
                  B1111111,
                 B0000000};         
const int _num9[] = {B1111111,
                  B1000001,
                  B1000001,
                  B1111111,
                  B1000000,
                  B1000000,
                  B1111111,
                 B00000000};
const int _num0[] = {B0001100,
                  B0010010,
                  B0100001,
                  B0100001,
                  B0100001,
                  B0010010,
                  B0001100,
                 B0000000};

//Load the bitmap charachters into an array (each charachters position corresponds to its previously defined index (ie _A (a's bitmap) 
//is at index 0 and A = 0 so letters[A] will return the 'A' bitmap)
const int* letters[] = {_A,_B,_C,_D,_E,_F,_G,_H,_I,_J,_K,_L,_M,_N,_O,_P,_Q,_R,_S,_T,_U,_V,_W,_X,_Y,_Z,_COL,_DASH,_BRA2,__, _FULL, _CHECK, _B2, _TEMP, _LINE, _SMILE, _DOT, _COLDOT,_num1,_num2,_num3,_num4,_num5,_num6,_num7,_num8,_num9,_num0};

//Setup runs once when power is applied
void setup()
{  Serial.begin(9600);
  for(int i = 0; i <8; i++){  //Set the 16 pins used to control the array as OUTPUTs
    pinMode(rowA[i], OUTPUT);
    pinMode(colA[i], OUTPUT);
  }
}

//repeats   

void loop()
{
  comdata1();
 updateMatrix();


}



void comdata1(){
   while (Serial.available() > 0)  
        {
            comdata += char(Serial.read());
            delay(2);
        }
        if (comdata.length() > 0)
        {
            Serial.println(comdata);
         
            comdata = "";
        
        }
    }    
  void updateMatrix(){
  loadSprite();
  showSprite(speed);
}  

//An array holding the powers of 2 these are used as bit masks when calculating what to display
const int powers[] = {1,2,4,8,16,32,64,128};

//Loads the current scroll state frame into the data[] display array
void loadSprite(){
  int currentChar = getChar(comdata[index]);
  int nextChar = getChar(comdata[index+1]);
  
  for(int row=0; row < 8; row++){                    //iterate through each row
    data[row] = 0;                                   //reset the row we're working on
    for(int column=0; column < 8; column++){         //iterate through each column
     data[row] = data[row] + ((powers[column] & (letters[currentChar][row] << offset)));   //loads the current charachter offset by offset pixels 
     data[row] = data[row] + (powers[column] & (letters[nextChar][row] >> (8-offset) ));   //loads the next charachter offset by offset pixels
    }
  }
  offset++;                                          //increment the offset by one row
  if(offset==8){offset = 0; index++; if(index==sizeof(comdata)-2){index=0;}}         //if offset is 8 load the next charachter pair for the next time through
}

void showSprite(int speed2){
 for(int iii = 0; iii < speed2; iii++){                 //show the current frame speed2 times
  for(int column = 0; column < 8; column++){            //iterate through each column
   for(int i = 0; i < 8; i++){                          
       digitalWrite(rowA[i], HIGH);                      //turn off all row pins  
   }
   for(int i = 0; i < 8; i++){ //Set only the one pin
     if(i == column){     digitalWrite(colA[i], HIGH);}  //turns the current row on
     else{                digitalWrite(colA[i], LOW); }//turns the rest of the rows off
   }

   for(int row = 0; row < 8; row++){                    //iterate through each pixel in the current column
    int bit = (data[column] >> row) & 1;
    if(bit == 1){ 
       digitalWrite(rowA[row], LOW);                   //if the bit in the data array is set turn the LED on
    }

   }
   delayMicroseconds(pauseDelay);                       //leave the column on for pauseDelay microseconds (too high a delay causes flicker)
  } 
 }
}//returns the index of a given charachter
//for converting from a string to a lookup in our array of charachter bitmaps

part3

int getChar(char charachter){
 int returnValue = Z;
 switch(charachter){
  case 'A': returnValue = A; break;
  case 'a': returnValue = A; break;
  case 'B': returnValue = B; break;
  case 'b': returnValue = B; break;
  case 'C': returnValue = C; break;
  case 'c': returnValue = C; break;
  case 'D': returnValue = D; break;
  case 'd': returnValue = D; break;
  case 'E': returnValue = E; break;
  case 'e': returnValue = E; break;
  case 'F': returnValue = F; break;
  case 'f': returnValue = F; break;
  case 'G': returnValue = G; break;
  case 'g': returnValue = G; break;
  case 'H': returnValue = H; break;
  case 'h': returnValue = H; break;
  case 'I': returnValue = I; break;
  case 'i': returnValue = I; break;
  case 'J': returnValue = J; break;
  case 'j': returnValue = J; break;
  case 'K': returnValue = K; break;
  case 'k': returnValue = K; break;
  case 'L': returnValue = L; break;
  case 'l': returnValue = L; break;
  case 'M': returnValue = M; break;
  case 'm': returnValue = M; break;
  case 'N': returnValue = N; break;
  case 'n': returnValue = N; break;
  case 'O': returnValue = O; break;
  case 'o': returnValue = O; break;
  case 'P': returnValue = P; break;
  case 'p': returnValue = P; break;
  case 'Q': returnValue = Q; break;
  case 'q': returnValue = Q; break;
  case 'R': returnValue = R; break;
  case 'r': returnValue = R; break;
  case 'S': returnValue = S; break;
  case 's': returnValue = S; break;
  case 'T': returnValue = T; break;
  case 't': returnValue = T; break;
  case 'U': returnValue = U; break;
  case 'u': returnValue = U; break;
  case 'V': returnValue = V; break;
  case 'v': returnValue = V; break;
  case 'W': returnValue = W; break;
  case 'w': returnValue = W; break;
  case 'X': returnValue = X; break;
  case 'x': returnValue = X; break;
  case 'Y': returnValue = Y; break;
  case 'y': returnValue = Y; break;
  case 'Z': returnValue = Z; break;
  case 'z': returnValue = Z; break;
  case ' ': returnValue = _; break;
  case '3': returnValue = B2; break;
  case '<': returnValue = TEMP; break;
  case '*': returnValue = FULL; break;
  case '|': returnValue = LINE; break;  
  case '_': returnValue = _; break;  
  case ':': returnValue = COL; break;  
  case '-': returnValue = DASH; break;  
  case ')': returnValue = BRA2; break;  
  case '%': returnValue = SMILE; break;  
  case '.': returnValue = DOT; break;    
  case '^': returnValue = COLDOT; break; 
case '1': returnValue = num1; break; 
case '2': returnValue = num2; break; 
case '4': returnValue = num4; break; 

  }
  return returnValue;
}

Have you tried a simpler, shorter, more easily debugged sketch?

  case 'A': returnValue = A; break;
  case 'a': returnValue = A; break;
  case 'B': returnValue = B; break;
  case 'b': returnValue = B; break;
  case 'C': returnValue = C; break;
  case 'c': returnValue = C; break;
  case 'D': returnValue = D; break;
  case 'd': returnValue = D; break;
  case 'E': returnValue = E; break;
  case 'e': returnValue = E; break;
  case 'F': returnValue = F; break;
  case 'f': returnValue = F; break;
  case 'G': returnValue = G; break;
  case 'g': returnValue = G; break;
  case 'H': returnValue = H; break;
  case 'h': returnValue = H; break;
  case 'I': returnValue = I; break;
  case 'i': returnValue = I; break;
  case 'J': returnValue = J; break;
  case 'j': returnValue = J; break;
  case 'K': returnValue = K; break;
  case 'k': returnValue = K; break;
  case 'L': returnValue = L; break;
  case 'l': returnValue = L; break;
  case 'M': returnValue = M; break;
  case 'm': returnValue = M; break;
  case 'N': returnValue = N; break;
  case 'n': returnValue = N; break;
  case 'O': returnValue = O; break;
  case 'o': returnValue = O; break;
  case 'P': returnValue = P; break;
  case 'p': returnValue = P; break;
  case 'Q': returnValue = Q; break;
  case 'q': returnValue = Q; break;
  case 'R': returnValue = R; break;
  case 'r': returnValue = R; break;
  case 'S': returnValue = S; break;
  case 's': returnValue = S; break;
  case 'T': returnValue = T; break;
  case 't': returnValue = T; break;
  case 'U': returnValue = U; break;
  case 'u': returnValue = U; break;
  case 'V': returnValue = V; break;
  case 'v': returnValue = V; break;
  case 'W': returnValue = W; break;
  case 'w': returnValue = W; break;
  case 'X': returnValue = X; break;
  case 'x': returnValue = X; break;
  case 'Y': returnValue = Y; break;
  case 'y': returnValue = Y; break;
  case 'Z': returnValue = Z; break;
  case 'z': returnValue = Z; break;

or

  if ((charachter >= 'a' && charachter <='z') || 
      (charachter >= 'A' && charachter <='Z'))
  {    
    returnValue = toupper (charachter) - 'A';
  }
const int powers[] = {1,2,4,8,16,32,64,128};

Wuh?

no but the question is that when i put the word in the led matrix cannot diplay it , but i can see the word print in the monitor

when i put the word in the led matrix cannot diplay it , but i can see the word print in the monito

Could that be because as soon as you enter a string and print it, you forget about it?

   if (comdata.length() > 0) {
     Serial.println(comdata);
     comdata = "";
   }

but how can i diplay in the led matrix?

just like this http://www.youtube.com/watch?v=3mzN5QnAiSE but i want to use the monitor for the input

but how can i diplay in the led matrix?

Don't forget it.

Presumably, somewhere in your development process, there was a time when the matrix worked (otherwise you wouldn't have expanded your code so much), so you could go back to that and figure out where you went wrong.

Can I recommend the auto-format tool in the IDE? If you hit ctrl-T, it will indent your code and present it in a more readable state.

what is it?

what is it?

You've forgotten it already again? See reply #5

AWOL:

what is it?

You've forgotten it already again? See reply #5

i did it. but I just want to input the text from the pc and output in the led matrix:(

Without writing the code for you, I don't think I can make it much clearer - remove the line that makes your sketch forget what you just entered.

thank you very much . i can run the text now . :) :) :)

I'm sorry for appearing obtuse or obstructive, but sometimes (most times, even) software only gives you a glimpse of what is wrong, sometimes a distorted reflection of the underlying cause. It is an important skill to learn to solve sometime incomplete puzzles from inferences and experimentation.

Thanks for sticking with it.

Also: sizeof(comdata) is almost certainly [u]not[/u] what you want.