/* PS/2 Keyboard Interface v2 David Johnson-Davies - www.technoblogy.com - 10th September 2016 Arduino Uno or ATmega328 CC BY 4.0 Licensed under a Creative Commons Attribution 4.0 International license: http://creativecommons.org/licenses/by/4.0/ */ #define KeymapSize 132 const int DataPin = 4; const int IRQpin = 2; const char Keymap[] PROGMEM = // Without shift " \011` q1 zsaw2 cxde43 vftr5 nbhgy6 mju78 ,kio09" " ./l;p- \' [= \015] \\ \010 1 47 0.2568\033 +3-*9 " // With shift " \011~ Q! ZSAW@ CXDE$# VFTR% NBHGY^ MJU&* ?L:P_ \" {+ \015} | \010 1 47 0.2568\033 +3-*9 "; ISR(INT0_vect) { static int ScanCode = 0, ScanBit = 1, Break = 0, Modifier = 0, Shift = 0; if (PIND & 1<> 1; ScanCode = 0, ScanBit = 1; if (s == 0xAA) return; // BAT completion code // if (s == 0xF0) { Break = 1; return; } if (s == 0xE0) { Modifier = 1; return; } if (Break) { if ((s == 0x12) || (s == 0x59)) Shift = 0; Break = 0; Modifier = 0; return; } if ((s == 0x12) || (s == 0x59)) Shift = 1; if (Modifier) return; char c = pgm_read_byte(&Keymap[s + KeymapSize*Shift]); if (c == 32 && s != 0x29) return; Serial.print(c); return; } void setup() { EICRA = 2<