// Keyboard Matrix Tutorial Example
// baldengineer.com
// CC BY-SA 4.0
  
// JP1 is an input
byte keys[] = {16, 17, 5, 18};
byte pressed[] = {0, 0, 0, 0};
byte KEYLEN = 4;
 
void setup() {
    Serial.begin(9600);
    for(int i = 0; i < KEYLEN; i++) {
      pinMode(keys[i], INPUT_PULLUP);
    }
}
void loop() {
    for(int i = 0; i < KEYLEN; i++) {
      pressed[i] = !digitalRead(keys[i]);
      Serial.print(String(pressed[i]) + " ");
    }
    Serial.println();
    delay(50);
}
