| 안녕하세요 ? 학교에서 아두이노를 공부하고 있는 학생 입니다 아두이노 8x8 MATRIX LED 모듈을 이용하여 글자를 띄우고 {0,0,0,1,1,0,0,0},  EX)  8x8 MATRIX LED 모듈 문자 A의 배열 define A{0,0,1,0,0,1,0,0},
 {0,0,1,0,0,1,0,0},
 {0,1,1,1,1,1,1,0},
 {0,1,0,0,0,0,1,0},
 {0,1,0,0,0,0,1,0},
 {0,1,0,0,0,0,1,0};
 왼쪽으로이동하는 소스 작업 하기위하는데 주석을 다는중에 90% 거의해결하였는데 이해가 안되는 void 함수가 1개 있어서 여기서질문드리게 되었습니다 밑에 소스에 이해가 안되는 부분에 대해서 빨간색으로 글자를 바꾸었습니다. 1. if ( gDisplayIntervalCounter < gDisplayInterval)          return;  여기서 return 을하게되면 어떻게 되나요 ?
 2. void SetMatrixChar 의 if문 에서 charArr[i] chararry[i] -'A'; 하는 이유 ? 3. void SetMatrixChar 에서 boolean findNullFlag = true; 하고 break 하면 어떻게 되나요 ? 3. void SetMatrixChar 에서 else if chararray[i] == '\0' 에서 \0' 는 소스에서 어떤 역할을 수행하나요 ? 4. void SetMatrixChar(const*char chararray) 역할을 잘 모르겠습니다 #include
 #define A { 0x18,0x24,0x24,0x42,0x7E,0x42,0x42,0x42 }
 
 #define B { 0x7C,0x42,0x42,0x7C,0x42,0x42,0x42,0x7C }
 
 #define C { 0x18,0x24,0x40,0x40,0x40,0x40,0x24,0x18 }
 
 #define D { 0x78,0x44,0x42,0x42,0x42,0x42,0x44,0x78 }
 
 #define E { 0x7E,0x40,0x40,0x7E,0x40,0x40,0x40,0x7E }
 
 #define F { 0x7E,0x40,0x40,0x7C,0x40,0x40,0x40,0x40 }
 
 #define G { 0x18,0x24,0x40,0x40,0x46,0x42,0x24,0x18 }
 
 #define H { 0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42 }
 
 #define I { 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08 }
 
 #define J { 0x02,0x02,0x02,0x02,0x02,0x42,0x24,0x18 }
 
 #define K { 0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x42 }
 
 #define L { 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7E }
 
 #define M { 0x66,0x5A,0x5A,0x5A,0x5A,0x5A,0x42,0x42 }
 
 #define N { 0x42,0x62,0x52,0x52,0x4A,0x4A,0x46,0x42 }
 
 #define O { 0x18,0x24,0x42,0x42,0x42,0x42,0x24,0x18 }
 
 #define P { 0x7C,0x42,0x42,0x42,0x7C,0x40,0x40,0x40 }
 
 #define Q { 0x18,0x24,0x42,0x42,0x42,0x4E,0x26,0x1A }
 
 #define R { 0x7C,0x42,0x42,0x42,0x7C,0x48,0x44,0x42 }
 
 #define S { 0x3C,0x42,0x40,0x20,0x1C,0x02,0x02,0x3C }
 
 #define T { 0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08 }
 
 #define U { 0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18 }
 
 #define V { 0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18 }
 
 #define W { 0x44,0x44,0x54,0x54,0x54,0x28,0x28,0x28 }
 
 #define X { 0x42,0x24,0x18,0x18,0x18,0x24,0x42,0x42 }
 
 #define Y { 0x44,0x44,0x44,0x28,0x10,0x10,0x10,0x10 }
 
 #define Z { 0x7E,0x02,0x04,0x08,0x10,0x20,0x40,0x7E }
 
 #define SPACE { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }
 
 #define SPACE_INDEX 26
 #define MAX_CHAR   20
 int cols[8] = {0,1,2,3,4,5,6,7};      //MATRIX 모듈에서 cols과 연결된 핀입니다.
 int rows[8] = {14,15,16,17,18,19,20,21}; //MATRIX 모듈에서 rows와 연결된 핀입니다.
 const byte font[SPACE_INDEX+1][8] = {  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,SPACE };
 
 byte charArr[MAX_CHAR+1];
 int gSaveCharLen;
 int gCurCharIndex;
 int gCurStartColumnIndex;
 int gCurColumnIndex;
 int gColumnCounter;
 int gDisplayInterval = 5000;
 int gDisplayIntervalCounter;
 byte curCharData[8]; //
         void SetMatrixChar(const char* chararray ) {  //표시할 문자를 저장하는 함수로 A~Z까지 비교하여 문자가 같으면 버퍼에 저장하는 함수
 boolean findNullFlag = false;
 
 for(int i = 0; i <  MAX_CHAR ; i++ )
 {   if ( ('A'<= chararray[i]) && ('Z' >= chararray[i]) )   {
 charArr[i] = chararray[i] - 'A';    }
 
 
 else if ( chararray[i] == '\0' )   {
 gSaveCharLen = i;
 charArr[i] = SPACE_INDEX;
 findNullFlag = true;
 break;
 
 }
 else   {
 charArr[i] = SPACE_INDEX;
 
 }
 }
 if (!findNullFlag) {
 gSaveCharLen = MAX_CHAR;
   charArr[MAX_CHAR] = SPACE_INDEX; }
 }
     
 void setup(){
 for(int i= 0; i< 8 ;i++ )
 {
 pinMode(cols[i], OUTPUT);
 digitalWrite(cols[i], HIGH);
 pinMode(rows[i], OUTPUT);
 digitalWrite(rows[i], LOW);
 }
 
     gCurColumnIndex = 0;  
 }
     void MatrixPerodicDisplay(){
 digitalWrite(rows[gCurColumnIndex], LOW); // previous row off
 gCurColumnIndex++;
 if ( gCurColumnIndex >= 8 )
 gCurColumnIndex = 0;
 
 for (int i = 0; i < 8 ; i++ )
 {  if ( curCharData[gCurColumnIndex] & (0x80 >> i) )  {
 digitalWrite(cols[i], LOW);  }
 else  {
 digitalWrite(cols[i], HIGH);
 }
 }
 digitalWrite(rows[gCurColumnIndex], HIGH); // previous row ON
 }
 
         void SlideChange() {
 gDisplayIntervalCounter++;
 if ( gDisplayIntervalCounter < gDisplayInterval)
 return;       //조건만족시함수void SlideChange() 함수종료 ? or gDisplayIntervalCounter++;로 돌아감 (?)
 
 
 gDisplayIntervalCounter = 0;
 gCurStartColumnIndex++;
 if ( gCurStartColumnIndex >= 8 )
 {
 gCurStartColumnIndex = 0;
 gCurCharIndex++;
 if ( gCurCharIndex >= gSaveCharLen )
 {
 gCurCharIndex = 0;
 }
 }
 for(int i = 0; i < 8 ; i++)
 {            curCharData[i] = (font[charArr[gCurCharIndex]][i] << gCurStartColumnIndex) | \
 (font[charArr[gCurCharIndex + 1]][i] >> (8 - gCurStartColumnIndex));
 }
 
 }       void loop(){
 MatrixPerodicDisplay();
 SlideChange();
 SetMatrixChar("HELLO  HELLO");
 
 }
   |