Skip to content

Instantly share code, notes, and snippets.

@sunify
Last active November 11, 2021 20:17
Show Gist options
  • Save sunify/b2719a9f6fdc42cfc157804e5b209648 to your computer and use it in GitHub Desktop.
Save sunify/b2719a9f6fdc42cfc157804e5b209648 to your computer and use it in GitHub Desktop.
#include <Keypad.h>
#include <Keyboard.h>
const byte ROWS = 3;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'7','8','9'},
{'4','5','6'},
{'1','2','3'}
};
byte rowPins[ROWS] = {10, 16, 14};
byte colPins[COLS] = {9, 8, 7};
// Если замыкаются пины 10 и 9, печатаем 7. Если замыкаются 14 и 7 — 3 и т.д.
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
Keyboard.begin();
}
void loop(){
char customKey = customKeypad.getKey();
Keyboard.write(customKey);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment