PS2 KEYBOARD ...SEND A STRING WHEN
hey im trying print complete string of text serial port has been typed on ps2 keyboard when pressed enter.
im using following libary
http://www.arduino.cc/playground/main/ps2keyboardext2
the problem im having detect cr , ( "enter") keyboard send text.
the libary has commards other keys backspace ect .. cant find varible enter key.
but ... send enter when print directly serial port.
so im thinking enter byte ?
any ideas ?
any great .
cheers
luke
im using following libary
http://www.arduino.cc/playground/main/ps2keyboardext2
the problem im having detect cr , ( "enter") keyboard send text.
the libary has commards other keys backspace ect .. cant find varible enter key.
but ... send enter when print directly serial port.
so im thinking enter byte ?
code: [select]
#define kbd_clk_pin 3
#define kbd_data_pin 4
ps2keyboard keyboard;
void setup() {
keyboard.begin(kbd_data_pin);
serial.begin(9600);
delay(1000);
}
#define is_printable(c) (!(c&0x80)) // don't print if top bit set
void loop() {
if(keyboard.available()) {
// reading "extra" bits optional
byte = keyboard.read_extra(); // must read before reading character byte
byte c = keyboard.read();
if (c==ps2_kc_up) { // commards libary cant find 1 enter .
serial.print("up\n"); {
serial.print(c); // prints serial port including enter
}
any ideas ?
any great .
cheers
luke
the ps2_ constants non-ascii keys, such left , right arrows. enter key generates ascii value. it's either 10 or 13 (one carriage return, other line feed. can never keep them straight, , don't have book handy).
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > PS2 KEYBOARD ...SEND A STRING WHEN
arduino
Comments
Post a Comment