PS/2 Cookbook Library doesn't seem to work?

26 Sep 2012

Hi there, I'm trying to get a PS/2 keyboard to work. I have a PS/2 breakout board from Sparkfun. I've double checked my wiring a million times and it seems to be correct. My only change is that I leave the Mouse pins unconnected because I don't intend to use a mouse.

Anyway, with this example program:

#include "mbed.h"
#include "PS2Keyboard.h"

PS2Keyboard ps2kb(p12, p11);
Serial serial(USBTX, USBRX);

int main() {

    PS2Keyboard::keyboard_event_t evt_kb;
    serial.baud(115200);
    serial.printf("Alive!");
    while (1) {
        if (ps2kb.processing(&evt_kb)) {
            serial.printf("[%d]:", evt_kb.type);
            for (int i = 0; i < evt_kb.length; i++) {
                serial.printf("%02x ", evt_kb.scancode[i]);
            }
            serial.printf("\n");
        }
    }
}

The odd behavior is that the Alive message doesn't print for about a minute. And after it does print, ps2kb.processing never seems to return true as I never get another message. Has anyone else had this problem? What could I be doing wrong?

EDIT: Ah, disregard this post. It was a wiring issue after all. I had to use a multimeter to figure out my breadboard has a broken connection across it's power rails