CD74HC147E High Speed CMOS Logic 10-to-4 Line Priority Encoder

used products:

1. Arduino UNO
2. CD74HC147E

Arduino:

#define H 1 #define L 0 int pins[] = {2,3,4,5,6,7,8,9,10}; int array[][9] = { {H,H,H,H,H,H,H,H,H}, {H,H,H,H,H,H,H,H,L}, {H,H,H,H,H,H,H,L,H}, {H,H,H,H,H,H,L,H,H}, {H,H,H,H,H,L,H,H,H}, {H,H,H,H,L,H,H,H,H}, {H,H,H,L,H,H,H,H,H}, {H,H,L,H,H,H,H,H,H}, {H,L,H,H,H,H,H,H,H}, {L,H,H,H,H,H,H,H,H} }; void setup() { for (int i = 0; i < 9; i++) { pinMode(pins[i], OUTPUT); } } void loop() { for (int j = 0; j < 10; j++) { for (int i = 8; i >= 0; i--) { digitalWrite(pins[i], array[j][i]); } delay(500); } }