代碼: 選擇全部
#include <LedControl.h>
LedControl lc=LedControl(12,11,10,2);//DIN=12 CS=10 CLK=11 2個裝置
int Led_Delay=2;
int row;//列
#define T_PUSH 2;//第D2腳位
unsigned long Time_Get = 0;
//-----------------------------------------------------------------
//---分鐘個位數 Min_Single
byte Min_Single0[8]={0x07,0x07,0x05,0x05,0x05,0x05,0x07,0x07};
byte Min_Single1[8]={0x07,0x02,0x02,0x02,0x02,0x02,0x06,0x02};
byte Min_Single2[8]={0x07,0x04,0x04,0x07,0x07,0x01,0x01,0x07};
byte Min_Single3[8]={0x07,0x01,0x01,0x07,0x07,0x01,0x01,0x07};
byte Min_Single4[8]={0x01,0x01,0x01,0x07,0x07,0x05,0x05,0x05};
byte Min_Single5[8]={0x07,0x01,0x01,0x07,0x07,0x04,0x04,0x07};
byte Min_Single6[8]={0x07,0x05,0x05,0x07,0x07,0x04,0x04,0x04};
byte Min_Single7[8]={0x01,0x01,0x01,0x01,0x05,0x05,0x07,0x07};
byte Min_Single8[8]={0x07,0x05,0x05,0x07,0x07,0x05,0x05,0x07};
byte Min_Single9[8]={0x07,0x01,0x01,0x07,0x07,0x05,0x05,0x07};
//---分鐘拾位數 Min_Tens
byte Min_Tens0[8]={0x70,0x70,0x50,0x50,0x50,0x50,0x70,0x70};
byte Min_Tens1[8]={0x70,0x20,0x20,0x20,0x20,0x20,0x60,0x20};
byte Min_Tens2[8]={0x70,0x40,0x40,0x70,0x70,0x10,0x10,0x70};
byte Min_Tens3[8]={0x70,0x10,0x10,0x70,0x70,0x10,0x10,0x70};
byte Min_Tens4[8]={0x10,0x10,0x10,0x70,0x70,0x50,0x50,0x50};
byte Min_Tens5[8]={0x70,0x10,0x10,0x70,0x70,0x40,0x40,0x70};
byte Min_Tens6[8]={0x70,0x50,0x50,0x70,0x70,0x40,0x40,0x40};
byte Min_Tens7[8]={0x10,0x10,0x10,0x10,0x50,0x50,0x70,0x70};
byte Min_Tens8[8]={0x70,0x50,0x50,0x70,0x70,0x50,0x50,0x70};
byte Min_Tens9[8]={0x70,0x10,0x10,0x70,0x70,0x50,0x50,0x70};
//---小時個位數 Hour_Single
byte Hour_Single0[8]={0x0E,0x0E,0x0A,0x0A,0x0A,0x0A,0x0E,0x0E};
byte Hour_Single1[8]={0x0E,0x04,0x04,0x04,0x04,0x04,0x0C,0x04};
byte Hour_Single2[8]={0x0E,0x08,0x08,0x0E,0x0E,0x02,0x02,0x0E};
byte Hour_Single3[8]={0x0E,0x02,0x02,0x0E,0x0E,0x02,0x02,0x0E};
byte Hour_Single4[8]={0x02,0x02,0x02,0x0E,0x0E,0x0A,0x0A,0x0A};
byte Hour_Single5[8]={0x0E,0x02,0x02,0x0E,0x0E,0x08,0x08,0x0E};
byte Hour_Single6[8]={0x0E,0x0A,0x0A,0x0E,0x0E,0x08,0x08,0x08};
byte Hour_Single7[8]={0x02,0x02,0x02,0x02,0x0A,0x0A,0x0E,0x0E};
byte Hour_Single8[8]={0x0E,0x0A,0x0A,0x0E,0x0E,0x0A,0x0A,0x0E};
byte Hour_Single9[8]={0x0E,0x02,0x02,0x0E,0x0E,0x0A,0x0A,0x0E};
//---小時拾位數 Hour_Tens
byte Hour_Tens0[8]={0xE0,0xE0,0xA0,0xA0,0xA0,0xA0,0xE0,0xE0};
byte Hour_Tens1[8]={0xE0,0x40,0x40,0x40,0x40,0x40,0xC0,0x40};
byte Hour_Tens2[8]={0xE0,0x80,0x80,0xE0,0xE0,0x20,0x20,0xE0};
byte Hour_Tens3[8]={0xE0,0x20,0x20,0xE0,0xE0,0x20,0x20,0xE0};
byte Hour_Tens4[8]={0x20,0x20,0x20,0xE0,0xE0,0xA0,0xA0,0xA0};
byte Hour_Tens5[8]={0xE0,0x20,0x20,0xE0,0xE0,0x80,0x80,0xE0};
byte Hour_Tens6[8]={0xE0,0xA0,0xA0,0xE0,0xE0,0x80,0x80,0x80};
byte Hour_Tens7[8]={0x20,0x20,0x20,0x20,0xA0,0xA0,0xE0,0xE0};
byte Hour_Tens8[8]={0xE0,0xA0,0xA0,0xE0,0xE0,0xA0,0xA0,0xE0};
byte Hour_Tens9[8]={0xE0,0x20,0x20,0xE0,0xE0,0xA0,0xA0,0xE0};
//-----------------------------------------------------------------
void setup() {
for(int i=0;i<2;i++){ //2個矩陣LED初始設定
lc.shutdown(i,false);//
lc.setIntensity(i,1);//
lc.clearDisplay(i);//
}
}
void loop() {
// byte A2[3]={0xFD,0x8C,0x8F};
//--------------------------------------------------------
// byte A9[8]={0x70,0x10,0x10,0x70,0x70,0x50,0x50,0x70};
//--------------------------------------------------------
// byte C0[8]={A1[0]|A9[0],A1[1]|A9[1],A1[2]|A9[2],A1[3]|A9[3],A1[4]|A9[4],A1[5]|A9[5],A1[6]|A9[6],A1[7]|A9[7]};
for(int row=0;row<8;row++){
lc.setColumn(0,row,Min_Tens2[row]|Min_Single5[row]);//第一裝置 分用OR過濾另外半部
lc.setColumn(1,row,Hour_Tens1[row]|Hour_Single2[row]);//第二裝置 分用OR過濾另外半部
lc.setLed(0, 0, 5, true);//裝置0 上午秒點
lc.setLed(1, 7, 5, true);//裝置1 上午秒點
lc.setLed(0, 0, 2, true);//裝置0 下午秒點
lc.setLed(1, 7, 2, true);//裝置1 下午秒點
// lc.setColumn(1,row,A2[row]);//第二裝置
//Time_Get=millis();
delay(90);;
}
}
代碼: 選擇全部
#include <LedControl.h>
LedControl lc=LedControl(12,11,10,2);//DIN=12 CS=10 CLK=11 2個裝置
int Led_Delay=2;
int row;//列
#define T_PUSH 2;//第D2腳位
unsigned long Time_Get = 0;
//-----------------------------------------------------------------
//---時間字型---
byte T_Font0[8]={0xE0,0xE0,0xA0,0xA0,0xA0,0xA0,0xE0,0xE0};
byte T_Font1[8]={0xE0,0x40,0x40,0x40,0x40,0x40,0xC0,0x40};
byte T_Font2[8]={0xE0,0x80,0x80,0xE0,0xE0,0x20,0x20,0xE0};
byte T_Font3[8]={0xE0,0x20,0x20,0xE0,0xE0,0x20,0x20,0xE0};
byte T_Font4[8]={0x20,0x20,0x20,0xE0,0xE0,0xA0,0xA0,0xA0};
byte T_Font5[8]={0xE0,0x20,0x20,0xE0,0xE0,0x80,0x80,0xE0};
byte T_Font6[8]={0xE0,0xA0,0xA0,0xE0,0xE0,0x80,0x80,0x80};
byte T_Font7[8]={0x20,0x20,0x20,0x20,0xA0,0xA0,0xE0,0xE0};
byte T_Font8[8]={0xE0,0xA0,0xA0,0xE0,0xE0,0xA0,0xA0,0xE0};
byte T_Font9[8]={0xE0,0x20,0x20,0xE0,0xE0,0xA0,0xA0,0xE0};
void setup() {
for(int i=0;i<2;i++){ //2個矩陣LED初始設定
lc.shutdown(i,false);//
lc.setIntensity(i,1);//
lc.clearDisplay(i);//
}
}
void loop() {
for(int row=0;row<8;row++){
byte Hour_Tens=(T_Font1[row]);
byte Hour_Single=(T_Font2[row]>>4);
byte Min_Tens=(T_Font0[row]>>1);
byte Min_Single=(T_Font0[row]>>5);
lc.setColumn(1,row,Hour_Tens|Hour_Single);//第1裝置 分用OR過濾另外半部
lc.setColumn(0,row,Min_Tens|Min_Single);//第0裝置 分用OR過濾另外半部
lc.setLed(0, 0, 5, true);//裝置0 上午秒點
lc.setLed(1, 7, 5, true);//裝置1 上午秒點
lc.setLed(0, 0, 2, true);//裝置0 下午秒點
lc.setLed(1, 7, 2, true);//裝置1 下午秒點
//Time_Get=millis();
delay(90);;
}
}