#include <LedControl.h>
const uint8_t IMAGES1[][8] = {
{
0b00011000,
0b00011000,
0b00111100,
0b01011010,
0b01011010,
0b00100100,
0b00100100,
0b01100110
}};
const int IMAGES1_LEN = sizeof(IMAGES1)/8;
const uint8_t IMAGES[][8] = {
{
0b00110000,
0b00110000,
0b00011100,
0b00011010,
0b00101000,
0b00010100,
0b00100100,
0b00100010
},{
0b00110000,
0b00110000,
0b00011000,
0b00011100,
0b00011000,
0b00001100,
0b00001100,
0b00000110
},{
0b00110000,
0b00110000,
0b00011100,
0b00011010,
0b00101000,
0b00010100,
0b00100100,
0b00100010
},{
0b00110000,
0b00110000,
0b00011110,
0b00111001,
0b01001000,
0b00010100,
0b00100010,
0b01100001
},{
0b00110000,
0b00110000,
0b00011100,
0b00011010,
0b00101000,
0b00010100,
0b00100100,
0b00100010
},{
0b00110000,
0b00110000,
0b00011000,
0b00011100,
0b00011000,
0b00001100,
0b00001100,
0b00000110
},{
0b00110000,
0b00110000,
0b00011100,
0b00011010,
0b00101000,
0b00010100,
0b00100100,
0b00100010
},{
0b00110000,
0b00110000,
0b00011110,
0b00111001,
0b01001000,
0b00010100,
0b00100010,
0b01100001
}};
const int IMAGES_LEN = sizeof(IMAGES)/8;
// Pin 12:Data in, Pin 11: Clock, Pin 10: CS(Load)
LedControl lc=LedControl(13,11,12,1);
int x=1000;
int five = 3;
int three = 4;
int six = 2;
byte data3[10][8] = {{1,1,1,0,1,1,1,0}//0
,{0,0,1,0,1,0,0,0}//1
,{1,1,0,0,1,1,0,1}//2
,{0,1,1,0,1,1,0,1}//3
,{0,0,1,0,1,0,1,1}//4
,{0,1,1,0,0,1,1,1}//5
,{1,1,1,0,0,1,1,1}//6
,{0,0,1,0,1,1,0,0}//7
,{1,1,1,0,1,1,1,1}//8
,{0,1,1,0,1,1,1,1}//9
};
void setup() {
// put your setup code here, to run once:
for(int i=1; i<14;i++){
pinMode(i, OUTPUT);
}
lc.shutdown(0,false); // 關閉省電模式
lc.setIntensity(0,8); // 設定亮度為 8 (介於0~15之間)
lc.clearDisplay(0); // 清除螢幕
}
void people(){
for(int k=1;k<3;k++){
for(int i=0;i<IMAGES_LEN;i++){
for(int j=0;j<8;j++){
lc.setRow(0,j,IMAGES[i][j]);
}
delay(700);
}
}
}
void people1(){
//for(int k=1;k<3;k++){
for(int i=0;i<IMAGES1_LEN;i++){
for(int j=0;j<8;j++){
lc.setRow(0,j,IMAGES1[i][j]);
}
delay(700);
}
//}
}
void num(){
for(int j1=9;j1>=0;j1--){
digitalWrite(five,LOW);
for(int i1=0;i1<8;i1++){
digitalWrite(six,LOW);
digitalWrite(three, data3[j1][i1]);
digitalWrite(six,HIGH);
}
digitalWrite(five,HIGH);
for(int i=0;i<IMAGES_LEN;i++){
for(int j=0;j<8;j++){
lc.setRow(0,j,IMAGES[i][j]);
}
delay(200);
}
//delay(1000);
}
}
void loop() {
digitalWrite(5, HIGH);
digitalWrite(10, HIGH);
num();
//people();
people1();
// put your main code here, to run repeatedly:
//digitalWrite(5, HIGH);
//digitalWrite(10, HIGH);
//delay(10000);
digitalWrite(10, LOW);
for(int i=1;i<4;i++){
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(1000);
}
digitalWrite(5, LOW);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
//people();
num();
people1();
//delay(10000);
digitalWrite(7, LOW);
for(int i=1;i<4;i++){
digitalWrite(6, HIGH);
delay(1000);
digitalWrite(6, LOW);
delay(1000);
}
digitalWrite(5, HIGH);
//delay(10000);
digitalWrite(8, LOW);
}