1

I want to read the input of an ps/2 keyboard. I connect the keyboard by a connector to arduino mega 2560. Clk to pin 2 and data to 30. Now my question how can i program in C that when I click any key get the data and safe them. The major issue is that I haven't any clue how to get the data and store in a array without using the PS2keyboard.h library. With this it is easy i do this before :

setup(){
keyboard(data, iqrPin);
if keyboard.available()){
  char in = keyboard.read();
}
} 

Something like this works perfectly but how can I do this without all the keyboard library stuff. So in clear C without arduino library's?

9
  • 2
    Have you tried looking at the code of the library? There you could learn, how it interfaces the PS/2 keyboard, and adapt that code for your project. – chrisl Nov 22 '20 at 22:05
  • You may want to edit the question to make it clear whether or not your current arrangement is successfully reading the keyboard at all. As written that isn't clear, to me anyway. – timemage Nov 22 '20 at 22:07
  • I read out by the keyboard and print into my ide arduino ide bu serial.print(in); – Miro S. Nov 22 '20 at 22:16
  • I'm going to take that as "yes, that much is working." – timemage Nov 22 '20 at 22:21
  • 1
    Re “I tried to ask Google but they always use a library”: Your google-fu needs more work: PS/2 keyboard protocol returns exactly what you need. Re “how can i program in C”: The PS/2 Keyboard Library is free software: the source code is available and very clearly written. You have the right to study it and learn how it works. You don't need someone to spoon-feed that to you. – Edgar Bonet Nov 23 '20 at 9:40

Browse other questions tagged or ask your own question.