M74HC42B1 BCD to decimal decoder

Used Products:

1. Arduino UNO
2. M74HC42B1

Code:

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