Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int s0 = 8;
- int s1 = 9;
- int s2 = 10;
- int s3 = 11;
- int sig = 0;
- int multiplexer[16][4] = { {0,0,0,0}, //canale 0
- {0,0,0,1}, //canale 1
- {0,0,1,0}, //canale 2
- {0,0,1,1}, //canale 3
- {0,1,0,0}, //canale 4
- {0,1,0,1}, //canale 5
- {0,1,1,0}, //canale 6
- {0,1,1,1}, //canale 7
- {1,0,0,0}, //canale 8
- {1,0,0,1}, //canale 9
- {1,0,1,0}, //canale 10
- {1,0,1,1}, //canale 11
- {1,1,0,0}, //canale 12
- {1,1,0,1}, //canale 13
- {1,1,1,0}, //canale 14
- {1,1,1,1} //canale 14
- };
- void setup() {
- // put your setup code here, to run once:
- pinMode(s0,OUTPUT);
- pinMode(s1,OUTPUT);
- pinMode(s2,OUTPUT);
- pinMode(s3,OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- interfaccia(2);
- Serial.read();
- interfaccia(6);
- Serial.read();
- }
- void interfaccia(int canale) {
- int controllore[] = {s3,s2,s1,s0};
- for(int i=0;i<4;i++)
- digitalWrite(controllore[i],multiplexer[canale][i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment