MM74C922 16-Key Encoder

Used Products:

1. Arduino UNO
2. MM74C922N

Content:

Çeşme: http://embedded-lab.com/blog/mm74c922n-based-encoded-matrix-keypad/

Code:

#define PINA 7 #define PINB 6 #define PINC 5 #define PIND 4 int output; char str[16] = {'1', '2', '3', 'А', '4', '5', '6', 'B', '7', '8', '9', 'C', '*', '0', '#', 'D' }; void setup() { pinMode(PINA, INPUT); pinMode(PINB, INPUT); pinMode(PINC, INPUT); pinMode(PIND, INPUT); Serial.begin(9600); } void loop() { output = 0; output = output | digitalRead(PIND); output = output << 1; output = output | digitalRead(PINC); output = output << 1; output = output | digitalRead(PINB); output = output << 1; output = output | digitalRead(PINA); Serial.print("KEY = "); Serial.print(str[output]); Serial.println(); delay(50); }