PS2Keyboard library

Hi Everyone,

I am using the PS2Keyboard library from this Link. I've used the last library (2.3-Ctrl-Enter).

The problem is that it cannot detect the HOME, End, NumLock and other key. I went through the "PS2Keyboard.h" file, provided in the library, then I found that all the keys which cannot be detected are set to 0.

The question is that how can I find their corresponding value? And is it the same for all types of keyboards?

Many thanks,
Mahdiyar

The question is that how can I find their corresponding value? And is it the same for all types of keyboards?

You have to define it yourself. The library doesn't return scan codes but ASCII characters (UTF-8 to be exact). As there is no code for Home and End keys they are set to ignore. But of course you can define your own value to be returned in this case so your code reacts on it.

pylon:
You have to define it yourself. The library doesn't return scan codes but ASCII characters (UTF-8 to be exact). As there is no code for Home and End keys they are set to ignore. But of course you can define your own value to be returned in this case so your code reacts on it.

Thank you so much

pylon:
You have to define it yourself. The library doesn't return scan codes but ASCII characters (UTF-8 to be exact). As there is no code for Home and End keys they are set to ignore. But of course you can define your own value to be returned in this case so your code reacts on it.

Dear Pylon

The code that I used worked when I connect each wire separately to the board but when I use the keyboard with USB connection, it does not work properly. Actually, I connect the USB port of keyboard to a UB type A. Then I solder each pin to a wire and connect them to the board.

I couldn't find the problem.

Whould you please help to fix this problem?
Thanks,
Mahdiyar

but when I use the keyboard with USB connection, it does not work properly.

You cannot use the PS2Keyboard library with a USB keyboard, that's something completely different (although both are keyboards of course).

Actually, I connect the USB port of keyboard to a UB type A. Then I solder each pin to a wire and connect them to the board.

I cannot imagine that wiring from your text. Post a wiring diagram!

pylon:
You cannot use the PS2Keyboard library with a USB keyboard, that's something completely different (although both are keyboards of course).

Thank you for your reply. I cannot understand why ps2 lib does not work for USB. When you cut the wire of the keyboard with either USB or ps2 connection it has the same 4 wires of gnd, +5v, clock and data. I think that the ports is different while the signals are the same.

pylon:
I cannot imagine that wiring from your text. Post a wiring diagram.

I will upload the digram and modify the post tomorrow.

Many thanks,
Mahdiyar

I cannot understand why ps2 lib does not work for USB. When you cut the wire of the keyboard with either USB or ps2 connection it has the same 4 wires of gnd, +5v, clock and data. I think that the ports is different while the signals are the same.

That is wrong. USB has GND, 5V, D- and D+. Although both have 4 wires they are completely different.