SN54HC139, SN74HC139 Dual 2-Line to 4-Line Decoders/Demultiplexers

Used Products:

1. SN74HC139N

Code:

#define a1Pin 2 #define b1Pin 3 #define a2Pin 4 #define b2Pin 5 #define sleep 500 int matrix[][2] = { {0,0}, {0,1}, {1,0}, {1,1} }; void setup() { pinMode(a1Pin, OUTPUT); pinMode(b1Pin, OUTPUT); pinMode(a2Pin, OUTPUT); pinMode(b2Pin, OUTPUT); } void loop() { for (int i = 0; i < 4; i++) { digitalWrite(a1Pin, matrix[i][0]); digitalWrite(b1Pin, matrix[i][1]); digitalWrite(a2Pin, matrix[i][0]); digitalWrite(b2Pin, matrix[i][1]); delay(sleep); } }