跳到主要內容

 自 109 / 2 /25 起啟用

Arduino / 8*8LED矩陣 / 範例:亮一顆愛心

#include "LedControl.h"

LedControl lc=LedControl(12,11,10,1);
unsigned long delaytime=1000;
void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}

void writeHeartOnMatrix() {
  /* here is the data for the characters */
  byte heart[8]=
              {B01000010,
               B11100111,
               B11111111,
               B11111111,
               B11111111,
               B01111110,
               B00111100,
               B00011000};

  /* now display them one by one with a small delay */
  lc.setRow(0,0,heart[0]);
  lc.setRow(0,1,heart[1]);
  lc.setRow(0,2,heart[2]);
  lc.setRow(0,3,heart[3]);
  lc.setRow(0,4,heart[4]);
  lc.setRow(0,5,heart[5]);
  lc.setRow(0,6,heart[6]);
  lc.setRow(0,7,heart[7]);
  delay(delaytime);
  lc.clearDisplay(0);
  delay(delaytime);
}


void loop() { 
  writeHeartOnMatrix();
}

消息公佈欄

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