Hi there i have a PS2 keyboard and simple 16X2 LCD screen
does anybody have a source code that make the two interface ?
i've tried to write one bymyself using the examples in the arduino (the simple test for the keyboard using the keyboard libraray afcourse and the liquid display libraray)
here it is
/* in this program I will connect lcd to keyboard and print hello world
the circuit :
LCD -
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 6
* LCD D5 pin to digital pin 5
* LCD D6 pin to digital pin 4
* LCD D7 pin to digital pin 3
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Keyboard -
*Data - pin 8
*Clk - pin 2
*/
//includes
#include <LiquidCrystal.h> //LCD library
#include <PS2Keyboard.h> //Keyboard library
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//initialize the Keyboard
const int DataPin = 8;
const int IRQpin = 18;
PS2Keyboard keyboard;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
//set up the kyeboard to recieve data
delay(1000);
keyboard.begin(DataPin, IRQpin);
Serial.begin(9600);
Serial.println("Keyboard Test:");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
//lcd.setCursor(1,1);
//reading the keyboard and print it to the screen if necessary
if (keyboard.available()) {
// read the next key
char(c) = keyboard.read();
}
else {
// otherwise, just print all normal characters
char c = keyboard.read();
Serial.print(c);
}
}
the problem is that the code is complied and also can be uploaded to the arduibo the problem is...it doesnt do what is suppose to do which is :
each button i will press on the keyboard will appear on the lcd