Go Down

Topic: "Display"command in 8 X 8 matrix (Read 833 times) previous topic - next topic

arteegee

I am trying to display an array in an 8 X 8 lcd  matrix.  Some sketches I download have the command  "Display (xxxx);" , and it works.  If I use that, it does not work and I get the error :  'display was not declared in this scope' .
What am I missing?

marco_c

You are missing the code in post where you are asking for help.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

arteegee

Please excuse my unfamiliarity with some of the terms used in this forum , but I didn't understand your answer about "missing the code". 

marco_c

#3
Nov 28, 2017, 01:17 am Last Edit: Nov 28, 2017, 03:01 am by marco_c
In your original request you are asking someone to look at your source code in order to work out what your problem is. For this to happen you need to attach the code to your post. Otherwise all we can say is exactly what the compiler is telling you - 'display was not declared in this scope' .
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

arteegee

Code: [Select]


//2-dimensional array of row pin numbers:
int R[] = {2,7,A5,5,13,A4,12,A2}; 
// 2-dimensional array of column pin numbers:
int C[] = {6,11,10,3,A3,4,8,9};   
// *include("Display");
unsigned char firststage[8][8] =     
{  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0,   
  0,0,0,1,1,0,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, };
//delay(1000);                                                                                   

unsigned char secondstage[8][8] =     
 { 0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,1,0,0,1,0,0,   
  0,0,0,1,1,0,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,1,0,0,1,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, };
//delay(1000);
//}; 
 unsigned char thirdstage[8][8] =     
{   
 
  0,0,0,0,0,0,0,0, 
  0,1,0,0,0,0,1,0, 
  0,0,1,0,0,1,0,0,   
  0,0,0,1,1,0,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,1,0,0,1,0,0, 
  0,1,0,0,0,0,1,0, 
  0,0,0,0,0,0,0,0, };
//delay(1000);
unsigned char fourthstage[8][8] =     

  1,0,0,0,0,0,0,1, 
  0,1,0,0,0,0,1,0, 
  0,0,1,0,0,1,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,1,0,0,1,0,0, 
  0,1,0,0,0,0,1,0, 
  1,0,0,0,0,0,0,1, 
}; 
unsigned char fifthstage[8][8] =     

     
  1,0,1,0,1,0,1,0, 
  0,1,0,1,0,1,0,1, 
  1,0,1,0,1,0,1,0,   
  0,1,0,1,0,1,0,1, 
  1,0,1,0,1,0,1,0, 
  0,1,0,1,0,1,0,1, 
  1,0,1,0,1,0,1,0, 
  0,1,0,1,0,1,0,1, };
//delay(1000);
 unsigned char sixthstage[8][8] =     

  0,1,0,1,0,1,0,1, 
  1,0,1,0,1,0,1,0, 
  0,1,0,1,0,1,0,1,   
  1,0,1,0,1,0,1,0, 
  0,1,0,1,0,1,0,1, 
  1,0,1,0,1,0,1,0, 
  0,1,0,1,0,1,0,1, 
  1,0,1,0,1,0,1,0, };
//delay(1000);
unsigned char seventhstage[8][8] =     

  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0,   
  0,0,0,1,1,0,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, };
//delay(1000);
 unsigned char eigthstage[8][8] =     

 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0,   
  0,0,0,1,1,0,0,0, 
  0,0,0,1,1,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, 
  0,0,0,0,0,0,0,0, };
//delay(1000);







void setup() 

   // iterate over the pins:
  for(int i = 0;i<8;i++) 
  // initialize the output pins:
  { 
    pinMode(R[i],OUTPUT); 
    pinMode(C[i],OUTPUT); 
  } 

 
void loop() 

  for(int i = 0 ; i < 100 ; i++)        //Loop display 100 times
  { 
Display(firststage);                   //Display the "Big Heart" 
  }
  //delay(4000);
 

  //delay(3000);
 
 

 for(int i = 0 ; i < 100 ; i++)         //Loop display 50 times
  {     
Display(secondstage);                 //Display the "small Heart"
  } 

for(int i = 0 ; i < 100 ; i++)
{
Display(thirdstage);   
}
for(int i = 0 ; i < 100 ; i++)
{
Display(fourthstage);   
}
for(int i = 0 ; i < 100 ; i++)
{
Display(fifthstage);   
}
for(int i = 0 ; i < 10 ; i++)
{
Display(sixthstage);   
}
for(int i = 0 ; i < 10 ; i++)
{
Display(fifthstage);   
}
//for(int i = 0 ; i < 10 ; i++) {




+display.sixthstage;   
}

//for(int i = 0 ; i < 10 ; i++)
//{
/*Display(seventhstage);   
}for(int i = 0 ; i < 10 ; i++)
{
Display(eigthstage);   
}

for(int i = 0 ; i < 10 ; i++)
{
Display(seventhstage);   
}for(int i = 0 ; i < 10 ; i++)
{
Display(eigthstage);   
}for(int i = 0 ; i < 10 ; i++)
{
Display(seventhstage);   
}for(int i = 0 ; i < 100 ; i++)
{
Display(eigthstage);   
}
*/


 
void Display(unsigned char dat[8][8])   

  for(int c = 0; c<8;c++) 
  { 
    digitalWrite(C[c],LOW);//use thr column
    //loop
    for(int r = 0;r<8;r++) 
    { 
      digitalWrite(R[r],dat[r][c]); 
    } 
    delay(1); 
    Clear();  //Remove empty display light
  } 

 
void Clear()                          //清空显示 

  for(int i = 0;i<8;i++) 
  { 
    digitalWrite(R[i],LOW); 
    digitalWrite(C[i],HIGH); 
  }  } 


marco_c

You have an unbalanced } just before the function Display is defined

Code: [Select]


 
void Display(unsigned char dat[8][8])   


Also, note that 'display' and 'Display' are not the same thing.

When you post code please make sure that it is formatted properly (use Ctl-T in the IDE). Proper formatting can also help you find these sorts of errors as the indentation is different and does not fit the pattern you exepct to see in the code.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

arteegee

Thanks for being patient with a 91-yr-old newby. I'm trying...

Go Up