Hi guys;
When I download the library to use a PS2 Keyboard at this site http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html
and I try the sample program, the IDE yell “dataPin” not in this scope ← The scope message… and it has something to do with this function : keyboard.begin(DataPin, IRQpin ); Ok It is not compiling…Humm…
OK …So I open PS2keyboard.cpp and PS2keyboard.h with Microsoft Visual Studio .NET 2003 with C++ ( <— expensive IDE ) to check what is going on. In the .h file this line :
this section in the h file I change.
static void begin(uint8_t data_pin, uint8_t irq_pin, const PS2Keymap_t &map = PS2Keymap_US);
I change the data pin into data_pin and irq_pin and save the h file.
And in the cpp file : I change to all data pin to data_pin and irq_pin except DataPin because it is declare at the begining the cpp file. And I save the cpp file.
I re-compile, it work and the library even work on an old AT keyboard that I was testing even an AT Keypad I bought at Active Surplus for $5.00. Cool heh ! 8)
I hope it help other with this infomation.
This section in the cpp file I change.
void PS2Keyboard::begin(uint8_t data_pin, uint8_t irq_pin, const PS2Keymap_t &map) {
uint8_t irq_num=0;
DataPin = data_pin;
keymap = ↦
// initialize the pins
#ifdef INPUT_PULLUP
pinMode(irq_pin, INPUT_PULLUP);
pinMode(data_pin, INPUT_PULLUP);
#else
pinMode(irq_pin, INPUT);
digitalWrite(irq_pin, HIGH);
pinMode(data_pin, INPUT);
digitalWrite(data_pin, HIGH);
#endif