HD74LS139 Dual 2-line-to-4-line Decoders / Demultiplexers

Used Products:

1. Arduino UNO
2. HD74LS139P

Code:

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