You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use PS2Keyboard configured to UK to output bytes, as numbers instead of the acsii characters, the characters ¬ and £ , both accessed with shift key, cause some strange bytes to be returned, instead of the expected 172 and 163 respectively, it will return -62 -84 for ¬ and then -62 -93 for £. I cannot pinpoint what causes this.
EDIT: It has a problem with any of the codes within PS2Keyboard.h that are above 160.
EDIT: If the code processed is over 127, then 2 numbers are returned. I still haven't worked out why. Yes the example you gives does return the required character, but the set is not expandable beyond 128 as is, if the user wants to return a number from the routine. Can you think of why 2 numbers are being returned if the keycode is above 127?
Steps To Reproduce Problem
Use the following code and then SHIFT+3 or SHIFT + ` to reproduce this problem.
Please note that I have changed the pins used to suit my system.
Hardware & Software
Board Arduino Mega 2560
Shields / modules used N/A
Arduino IDE version 1.8.13
Teensyduino version (if using Teensy) N/A
Version info & package name (from Tools > Boards > Board Manager) 1.8.5
Operating system & version Windows 8.1
Any other software or hardware?
Arduino Sketch
// Change the code below by your sketch (please try to give the smallest code which demonstrates the problem)
#include<Arduino.h>// libraries: give links/details so anyone can compile your code for the same result
`/* PS2Keyboard library example PS2Keyboard now requries both pins specified for begin() keyboard.begin(data_pin, irq_pin); Valid irq pins: Arduino Uno: 2, 3 Arduino Due: All pins, except 13 (LED) Arduino Mega: 2, 3, 18, 19, 20, 21 Teensy 2.0: All pins, except 13 (LED) Teensy 2.0: 5, 6, 7, 8 Teensy 1.0: 0, 1, 2, 3, 4, 6, 7, 16 Teensy++ 2.0: 0, 1, 2, 3, 18, 19, 36, 37 Teensy++ 1.0: 0, 1, 2, 3, 18, 19, 36, 37 Sanguino: 2, 10, 11 for more information you can read the original wiki in arduino.cc at http://www.arduino.cc/playground/Main/PS2Keyboard or http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html Like the Original library and example this is under LGPL license. Modified by [email protected] on 2010-03-22 Modified by Paul Stoffregen <[email protected]> June 2010*/
#include<PS2Keyboard.h>constint DataPin = 8;
constint IRQpin = 3;
PS2Keyboard keyboard;
voidsetup() {
delay(1000);
keyboard.begin(DataPin, IRQpin);
Serial.begin(9600);
Serial.println("Keyboard Test:");
}
voidloop() {
if (keyboard.available()) {
// read the next keychar c = keyboard.read();
int h = (int)c;
// check for some of the special keysif (c == PS2_ENTER) {
Serial.println();
} elseif (c == PS2_TAB) {
Serial.print("[Tab]");
} elseif (c == PS2_ESC) {
Serial.print("[ESC]");
} elseif (c == PS2_PAGEDOWN) {
Serial.print("[PgDn]");
} elseif (c == PS2_PAGEUP) {
Serial.print("[PgUp]");
} elseif (c == PS2_LEFTARROW) {
Serial.print("[Left]");
} elseif (c == PS2_RIGHTARROW) {
Serial.print("[Right]");
} elseif (c == PS2_UPARROW) {
Serial.print("[Up]");
} elseif (c == PS2_DOWNARROW) {
Serial.print("[Down]");
} elseif (c == PS2_DELETE) {
Serial.print("[Del]");
} else {
// otherwise, just print all normal characters
Serial.print(c);
Serial.print("");
Serial.print(h);
Serial.print("");
}
}
}`
Errors or Incorrect Output
If you see any errors or incorrect output, please show it here. Please use copy & paste to give an exact copy of the message. Details matter, so please show (not merely describe) the actual message or error exactly as it appears.
Description
If I use PS2Keyboard configured to UK to output bytes, as numbers instead of the acsii characters, the characters ¬ and £ , both accessed with shift key, cause some strange bytes to be returned, instead of the expected 172 and 163 respectively, it will return -62 -84 for ¬ and then -62 -93 for £. I cannot pinpoint what causes this.
EDIT: It has a problem with any of the codes within PS2Keyboard.h that are above 160.
EDIT: If the code processed is over 127, then 2 numbers are returned. I still haven't worked out why. Yes the example you gives does return the required character, but the set is not expandable beyond 128 as is, if the user wants to return a number from the routine. Can you think of why 2 numbers are being returned if the keycode is above 127?
Steps To Reproduce Problem
Use the following code and then SHIFT+3 or SHIFT + ` to reproduce this problem.
Please note that I have changed the pins used to suit my system.
Hardware & Software
Board Arduino Mega 2560
Shields / modules used N/A
Arduino IDE version 1.8.13
Teensyduino version (if using Teensy) N/A
Version info & package name (from Tools > Boards > Board Manager) 1.8.5
Operating system & version Windows 8.1
Any other software or hardware?
Arduino Sketch
Errors or Incorrect Output
If you see any errors or incorrect output, please show it here. Please use copy & paste to give an exact copy of the message. Details matter, so please show (not merely describe) the actual message or error exactly as it appears.
PS2Keyboard.cpp has:
Line 411 :
0, PS2_F10, PS2_F8, PS2_F6, PS2_F4, PS2_TAB, 172 /* ¬ */, 0,
Line 414:
0, 'C', 'X', 'D', 'E', '$', 163 /* £ */, 0,
Both of these lines have a different method of numbering £ and ¬, I suspect there may have been trouble with them before.
The text was updated successfully, but these errors were encountered: