Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //{pin2,pin3,pin4,pin5,pin6,pin7,pin8,pin9}
- const char num[80] = {
- 0,1,1,1,1,1,1,0, //0
- 0,1,0,0,1,0,0,0, //1
- 1,0,1,1,1,1,0,0, //2
- 1,0,1,1,0,1,1,0, //3
- 1,1,0,1,0,0,1,0, //4
- 1,1,1,0,0,1,1,0, //5
- 1,1,1,0,1,1,1,0, //6
- 0,1,1,1,0,0,1,0, //7
- 1,1,1,1,1,1,1,0, //8
- 1,1,1,1,0,1,1,0}; //9
- void setup() {
- for(int i=2;i<10;i++){
- pinMode(i, OUTPUT);
- digitalWrite(i, LOW);
- }
- }
- void dispnum7segment(int n) {
- for(int i=0;i<8;i++){
- if(num[n*8+i]==1){digitalWrite(i+2,HIGH);}
- else{digitalWrite(i+2,LOW);
- }
- }
- void loop() {
- for(int k=0;k<10;k++){
- dispnum7segment(k);
- delay(1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement