38 lines
702 B
Arduino
38 lines
702 B
Arduino
|
// set an array to store character of “0”
|
||
|
unsigned char Text[]={0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c};
|
||
|
|
||
|
void Draw_point(unsigned char x,unsigned char y) {
|
||
|
clear_();
|
||
|
digitalWrite(x+2, HIGH);
|
||
|
digitalWrite(y+10, LOW);
|
||
|
delay(1);
|
||
|
}
|
||
|
void show_num(void) {
|
||
|
unsigned char i,j,data;
|
||
|
for(i=0;i<8;i++) {
|
||
|
data=Text[i];
|
||
|
for(j=0;j<8;j++) {
|
||
|
if(data & 0x01)
|
||
|
Draw_point(j,i);
|
||
|
data>>=1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
void setup(){
|
||
|
int i = 0 ;
|
||
|
for(i=2;i<18;i++) {
|
||
|
pinMode(i, OUTPUT);
|
||
|
}
|
||
|
clear_();
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
show_num();
|
||
|
}
|
||
|
void clear_(void) {
|
||
|
for(int i=2;i<10;i++)
|
||
|
digitalWrite(i, LOW);
|
||
|
for(int i=0;i<8;i++)
|
||
|
digitalWrite(i+10, HIGH);
|
||
|
}
|