2 * PS2 pinout cinskej kabel: data cerveny (18), clock bily (19), 5V cerny, GND zluty
8 PS2dev keyboard(19, 18); //clock, data
10 #include <LedControl.h>
12 LedControl lc=LedControl(16,14,15,2); //datain, clk, load, number of chips
18 const byte ROWS = 4; //four rows
19 const byte COLS = 3; //four columns
20 //define the cymbols on the buttons of the keypads
21 char hexaKeys[ROWS][COLS] = {
27 byte rowPins[ROWS] = {10, 9, 8, 7}; //connect to the row pinouts of the keypad
28 byte colPins[COLS] = {4, 5, 6}; //connect to the column pinouts of the keypad
30 //initialize an instance of class NewKeypad
31 Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
33 void make_break_kb(byte data)
35 // makes and breaks the key
44 char scancodes[] = {0x45, 0x16, 0x1E, 0x26, 0x25, 0x2E, 0x36, 0x3D, 0x3E, 0x46, 0x7C, 0x7C}; //Scancodes for numbers 0-9, *, #
50 The MAX72XX is in power-saving mode on startup,
51 we have to do a wakeup call
54 /* Set the brightness to a medium values */
55 lc.setIntensity(0,15); //0 - 15
56 /* and clear the display */
61 char customKey = customKeypad.getKey();
64 Serial.println(customKey);
65 analogWrite(keyledPin, random(0, 255));
66 unsigned char numkey = customKey-0x30;
68 lc.setDigit(0,0,numkey,false); //addr, digit, value, decimalpoint
69 lc.setDigit(0,7,numkey,false); //addr, digit, value, decimalpoint
70 make_break_kb(scancodes[numkey]);
74 if (customKey == '#') {
76 analogWrite(keyledPin, 0);
77 make_break_kb(scancodes[10]);