Hi everyone
I tried to connect PS2 cable of keyboard to arduino UNO and get the data from keyboard. I have read many pages on internet and also used different libraries of Arduino. The problem is that non of them cannot detect (read) the "PrtSc" button. Then, I tried to write the code myself. This is the code:
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, HEX);
}
}
The problem is that when I pressed key "1" different times, it gives me different three hex values comparing together. Interestingly, "PrtSc" works correctly and return the same value always.
Any help is appreciated in advance