How many PS/2 keyboards do you have? More than one, I'd bet. Well, stop trying to hang them on your tree, and use them not the whole thing just the encoder. BTW that's the little black thing on the rear.
1----DATA |
3----GROUND |
4----+5 V DC at 275 ma |
5----CLLK |
Of the six pins, we will only use four (4) of them. So what do we need? This will use an Arduino, and get this library:
Reference > Libraries > Ps2keyboard
This library is compatible with all architectures and boards.
Lib Code | My Code this code has NOT been tested. |
PS2Keyboard keyboard; void setup() { delay(1000); keyboard.begin(DataPin, IRQpin); Serial.begin(9600); Serial.println("Keyboard Test:"); } void loop() { if (keyboard.available()) { // read the next key char c = keyboard.read(); // check for some of the special keys if (c == PS2_ENTER) { Serial.println(); } else if (c == PS2_TAB) { Serial.print("[Tab]"); } else if (c == PS2_ESC) { Serial.print("[ESC]"); } else if (c == PS2_PAGEDOWN) { Serial.print("[PgDn]"); } else if (c == PS2_PAGEUP) { Serial.print("[PgUp]"); } else if (c == PS2_LEFTARROW) { Serial.print("[Left]"); } else if (c == PS2_RIGHTARROW) { Serial.print("[Right]"); } else if (c == PS2_UPARROW) { Serial.print("[Up]"); } else if (c == PS2_DOWNARROW) { Serial.print("[Down]"); } else if (c == PS2_DELETE) { Serial.print("[Del]"); } else { // otherwise, just print all normal characters Serial.print(c); } } } |
#include const int DataPin = 8; void setup() { delay(1000); keyboard.begin(DataPin, IRQpin); void IRQkey(if (keyboard.available()) { int keyProcess(){ |