Connect PS2 Keyboard To Arduino
Connect PS2 Keyboard To Arduino
Table of Contents
Step 2: Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Step 3: Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
http://www.instructables.com/id/Connect-PS2-Keyboard-to-Arduino/
Author:djsadeepa sadeepa01.blogspot.com
My life is Not only Writing Lines of Codes, But gaining something good. I'm simple in physical world but Very complex in ICT word.
5V :- Arduino 5V out
Ground :- Arduino GND
Clock :- Arduino Pin 3
Data :- Arduino Pin 8
http://www.instructables.com/id/Connect-PS2-Keyboard-to-Arduino/
Step 2: Code
First include this library to Arduino Software. http://www.pjrc.com/teensy/arduino_libraries/PS2Keyboard.zip
PS2Keyboard keyboard;
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); } } }
Step 3: Testing
So we have finished our coding, Upload it to arduino and keep the Arduino connected to PC.Then open the Serial Monitor on Arduino Software and Press some keys on
the Keyboard connected to Arduino and you will see It prints what you type on that keyboard.Comment your ideas.
Related Instructables
Advertisements
Comments
http://www.instructables.com/id/Connect-PS2-Keyboard-to-Arduino/