CD74HC4052E High-Speed CMOS Logic Analog Multiplexers/Demultiplexers

Used Products:

1. Arduino UNO
2. CD74HC4052E

Code:

#define s0Pin 2 #define s1Pin 4 #define sleep 200 int matrix[][2] = { {0,0}, {0,1}, {1,0}, {1,1} }; void setup() { pinMode(s0Pin, OUTPUT); pinMode(s1Pin, OUTPUT); } void loop() { for (int i = 0; i < 4; i++) { digitalWrite(s0Pin, matrix[i][1]); digitalWrite(s1Pin, matrix[i][0]); delay(sleep); } }