A test program for PS2 library.

Dependencies:   mbed

main.cpp

Committer:
shintamainjp
Date:
2010-08-29
Revision:
0:aabf6427c82e
Child:
1:e5eac8a97060

File content as of revision 0:aabf6427c82e:

/**
 * Test program.
 *
 * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
 * http://shinta.main.jp/
 */

#include "mbed.h"
#include "PS2.h"

PS2 ps2kb(p17, p18);

int main() {
    while (1) {
        /*
         * Keyboard.
         */
        if (ps2kb.exists()) {
            uint8_t buf[32];
            int n = ps2kb.getData(buf, sizeof(buf));
            printf("KB:");
            for (int i = 0; i < n; i++) {
                printf("%02X ", buf[i]);
            }
            printf("\n");
        }
        wait_ms(100);
    }
}