pleas i need help// i cant fix this// PS2keyboard was not decalre on this scope

#include < PS2Keyboard.h>

const int DataPin = 8;
const int IRQpin = 3;

PS2Keyboard keyboard;

void setup() {
delay(1000);
keyboard.begin(DataPin, IRQpin);
Serial.begin(9600);
Serial.println("Keyboard Test:");
}

void loop() {
if (keyboard.available()) {

// read the next key
char c = keyboard.read();
// check for some of the special keys
if (c == PS2_ENTER) {
Serial.println();
} else if (c == PS2_TAB) {
Serial.print("[Tab]");
} else if (c == PS2_ESC) {
Serial.print("[ESC]");
} else if (c == PS2_PAGEDOWN) {
Serial.print("[PgDn]");
} else if (c == PS2_PAGEUP) {
Serial.print("[PgUp]");
} else if (c == PS2_LEFTARROW) {
Serial.print("");
} else if (c == PS2_RIGHTARROW) {
Serial.print("");
} else if (c == PS2_UPARROW) {
Serial.print("[Up]");
} else if (c == PS2_DOWNARROW) {
Serial.print("[Down]");
} else if (c == PS2_DELETE) {
Serial.print("");
} else {

// otherwise, just print all normal characters
Serial.print(c);
}
}
}

Please format your sketch using ctrl-T in the IDE, and then repost or replace the code above with your sketch inside code tags, according to the forum guidelines.

Did you install the "PS2keyboard" library correctly?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.