跳到主要內容
教務主任 2201
教學組 2202
註冊組 2208
設備組 2210
實研組 2206
特教組 2204

   南投高商智能機房即時溫濕度
   溫度:0
   濕度:0 %
 
 
 
互動科技-創客教育 / 專題 / LED矩陣文字平移

MaxMatrix library下載
https://code.google.com/archive/p/arudino-maxmatrix-library/downloads

 

 

程式
 

#include
int DIN = 12;   // DIN pin of MAX7219 module
int CLK = 11;   // CLK pin of MAX7219 module
int CS = 10;    // CS pin of MAX7219 module
int maxInUse = 1;
MaxMatrix m(DIN, CS, CLK, maxInUse); 
char A[] = {4, 8,
            B01111110,
            B00010001,
            B00010001,
            B01111110,
           };
char B[] = {4, 8,
            B01111111,
            B01001001,
            B01001001,
            B00110110,
           };
char smile01[] = {8, 8,
                  B00111100,
                  B01000010,
                  B10010101,
                  B10100001,
                  B10100001,
                  B10010101,
                  B01000010,
                  B00111100
                 };
char smile02[] = {8, 8,
                  B00111100,
                  B01000010,
                  B10010101,
                  B10010001,
                  B10010001,
                  B10010101,
                  B01000010,
                  B00111100
                 };
char smile03[] = {8, 8,
                  B00111100,
                  B01000010,
                  B10100101,
                  B10010001,
                  B10010001,
                  B10100101,
                  B01000010,
                  B00111100
                 };
void setup() {
  m.init(); // MAX7219 initialization
  m.setIntensity(1); // initial led matrix intensity, 0-15
}
void loop() {
  // Seting the LEDs On or Off at x,y or row,column position
  m.setDot(6,2,true); 
  delay(1000);
  m.setDot(6,3,true);
  delay(1000);
  m.clear(); // Clears the display
  for (int i=0; i<8; i++){
    m.setDot(i,i,true);
    delay(300);
  }
  m.clear();
  // Displaying the character at x,y (upper left corner of the character)  
  m.writeSprite(2, 0, A);
  delay(1000);
    for (int i=0; i<8; i++){
    m.shiftLeft(false,false);
    delay(300);
  }
  m.writeSprite(2, 0, B);
  delay(1000);
    for (int i=0; i<8; i++){
    m.shiftLeft(false,false);
    delay(300);
  }
  m.writeSprite(0, 0, smile01);
  delay(1000);
  for (int i=0; i<8; i++){
    m.shiftLeft(false,false);
    delay(300);
  }  
  m.writeSprite(0, 0, smile02);
  delay(1000);
  for (int i=0; i<8; i++){
    m.shiftLeft(false,false);
    delay(300);
  }  
  m.writeSprite(0, 0, smile03);
  delay(1000);
  
  for (int i=0; i<8; i++){
    m.shiftLeft(false,false);
    delay(300);
  }
  m.clear();
}
 

消息公佈欄

時間類別單位標題發佈點閱
跳至網頁頂部