Ps2keyboard library

Hello!
It’s a lot of days that I’m searching if this library, “ps2keyboard” from Paul Stoffregen, is compatible with Arduino Uno R4. Anyone knows?

Thanks in advance!

it does not seem to be specifically listed in int_pins.h

So if you compile the code, you'll likely default to these define

And as the library depends on interrupts

you would need those 2 pins to be interrupts pins and the doc states they are

last but not least, the PJRC's doc for PS2Keyboard states

The keyboard's clock signal must connect to an interrupt pin. The data signal may connect to any pin, but do not use the pin with an LED connected to ground because the LED current will interfere with the data signal.

Board Data Pin Clock Pin (IRQ)
Teensy 3.6
Teensy 3.5
Teensy 3.2
Teensy 3.1
Teensy 3.0 Any
except 13 &
analog-only
pins Any
except 13 &
analog-only
pins
Teensy LC Any
except 13 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 14, 15, 20, 21, 22, 23
Teensy 2.0 Any, except 11 5, 6, 7, 8
Teensy 1.0 Any 0, 1, 2, 3, 4, 6, 7, 16
Teensy++ 2.0 Any, except 6 0, 1, 2, 3, 18, 19, 36, 37
Teensy++ 1.0 Any 0, 1, 2, 3, 18, 19, 36, 37

Caution : PS2 Keyboards contain pullup resistors to 5 volts which can cause damage to 3.3V only boards like Teensy LC and Teensy 3.6. Use of a level shifter circuit is needed to safely use boards which are not 5 volt tolerant.

➜ your board is a 5V board so should be fine, pick suitable pins as per the doc.

basically after reading all this, I feel the easiest way to find out if it works is to try :slight_smile:
(don't hold me responsible for breaking your new toy though...)

1 Like

Actually looking at the library link posted, you can add the following after the else statement so the end of the if def's would look like this

//STM32F1 support
#elif defined(__STM32F1__)
  #define CORE_INT_EVERY_PIN

#elif defined(ARDUINO_UNOR4_MINIMA)
//0, 1, 2, 3, 8, 12, 13, 15, 16, 17, 18 and 19.
  #define CORE_NUM_INTERRUPT	20
  #define CORE_INT0_PIN		0
  #define CORE_INT1_PIN		1
  #define CORE_INT2_PIN		2
  #define CORE_INT3_PIN		3
  #define CORE_INT8_PIN		8
  #define CORE_INT12_PIN	12
  #define CORE_INT13_PIN	13
  #define CORE_INT15_PIN	15
  #define CORE_INT16_PIN	16
  #define CORE_INT17_PIN	17
  #define CORE_INT18_PIN	18
  #define CORE_INT19_PIN	19
#elif defined(ARDUINO_UNOR4_WIFI)
//0, 1, 2, 3, 8, 12, 13, 15, 16, 17, 18 and 19.
  #define CORE_NUM_INTERRUPT	20
  #define CORE_INT0_PIN		0
  #define CORE_INT1_PIN		1
  #define CORE_INT2_PIN		2
  #define CORE_INT3_PIN		3
  #define CORE_INT8_PIN		8
  #define CORE_INT11_PIN	11
  #define CORE_INT12_PIN	12
  #define CORE_INT15_PIN	15
  #define CORE_INT16_PIN	16
  #define CORE_INT17_PIN	17
  #define CORE_INT18_PIN	18
  #define CORE_INT19_PIN	19

// Arduino Uno, Duemilanove, LilyPad, Mini, Fio, etc...
#else
  #define CORE_INT0_PIN  2
  #define CORE_INT1_PIN  3

#endif

same interrupt definitions used for the encoder library. So should work here from what I saw in the library. Never used that library so let me know if it works. Then can issue a PR.

Thanks to you both! In the following weeks I try to use this library and I'll let you know.

Have a good nignt!!