Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int a=0;
- int b=0;
- int c=0;
- int d=0;
- int numero=0;
- int disp[][7]={
- {1, 1, 1, 1, 1, 1, 0},
- {0, 1, 1, 0, 0, 0, 0},
- {1, 1, 0, 1, 1, 0, 1},
- {1, 1, 1, 1, 0, 0, 1},
- {0, 1, 1, 0, 0, 1, 1},
- {1, 0, 1, 1, 0, 1, 1},
- {1, 0, 1, 1, 1, 1, 1},
- {1, 1, 1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1, 1, 1},
- {1, 1, 1, 1, 0, 1, 1},
- {1, 1, 1, 0, 1, 1, 1},
- {0, 0, 1, 1, 1, 1, 1},
- {1, 0, 0, 1, 1, 1, 0},
- {0, 1, 1, 1, 1, 0, 1},
- {1, 0, 0, 1, 1, 1, 1},
- {1, 0, 0, 0, 1, 1, 1}
- };
- void setup() {
- pinMode(2, INPUT_PULLUP);
- pinMode(3, INPUT_PULLUP);
- pinMode(4, INPUT_PULLUP);
- pinMode(5, INPUT_PULLUP);
- pinMode(13, OUTPUT);
- pinMode(12, OUTPUT);
- pinMode(11, OUTPUT);
- pinMode(10, OUTPUT);
- pinMode(9, OUTPUT);
- pinMode(8, OUTPUT);
- pinMode(7, OUTPUT);
- }
- void loop() {
- if(digitalRead(2)==LOW){
- a=1;
- }else{
- a=0;
- }
- if(digitalRead(3)==LOW){
- b=1;
- }else{
- b=0;
- }
- if(digitalRead(4)==LOW){
- c=1;
- }else{
- c=0;
- }
- if(digitalRead(5)==LOW){
- d=1;
- }else{
- d=0;
- }
- numero = a*1 + b*2 + c*4 + d*8;
- for(int i=0; i<7; i++){
- digitalWrite(13-i, disp[numero][i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement