PS2Keyboard on Arduino Mega

I've been trying to understand how to get this working, I'm new to the Arduino and micro programming, but learning.

I'm confused which pins I should be connecting my keyboard to. In the example the pins are defined as

#define KBD_CLK_PIN  3
#define KBD_DATA_PIN 4

but from a schematic of the Mega I'm understanding that pin 3 is actually INT5 and the attachInterrupt(1, ps2interrupt, FALLING); which is found in the PS2Keyboard.ccp file should be 5 instead of 1.

Although I must still be doing something wrong as it dosn't yet work.

Any suggestions ?

Also the description at attachInterrupt() - Arduino Reference

"Most Arduino boards have two external interrupts: numbers 0 (on digital pin 2) and 1 (on digital pin 3). The Arduino Mega has an additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5 (pin 18)."

seems to contradict the schematic http://arduino.cc/en/uploads/Main/arduino-mega-schematic.pdf ?

I must be confusing things and not understanding quite right.

""Most Arduino boards have two external interrupts: numbers 0 (on digital pin 2) and 1 (on digital pin 3). The Arduino Mega has an additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5 (pin 18)."

The pin mapping is different for the mega processor but the pin assignments Vs user interrupt number is accounted for in the mega mapping and the above quoted pin numbers are the ones to use, I'm pretty sure.

So interrupt 0 wires to Arduino pin 2, interrupt 1 to pin 3, for both normal and Mega boards. So don't change the PS2Keyboard.ccp file. There is probably some other reason you are having trouble.

At least that is my read on it. :wink:

Lefty

thanks retrolefty

That gave me the confidence to persist with those pins... and check/double check connections etc and make sure I had everything round the right way with the scope etc... It works now it was a bad connection or wires around the wrong way. :smiley:

nduddy