How to make a binary keyboard

Feedback, questions: send mail to eoinmcl at netsoc.tcd.ie
There is no button for backwards

Its simple really. Much better than your average keyboard:
wowzers!

Ingredients:
1 keyboard (0 to 6 euro)
2 buttons (About 50 cent each)
A lunchbox (One pictured was 39 cent)
Bits of wire (Gratis)


Now, simple steps.
  1. Open up the keyboard, and take everything apart.
  2. Spell out hilarious phrases with the keys.
  3. Take the PCB from the keyboard, and while the keyboard is plugged in, use a piece of wire to touch each IC pin to each other IC pin and note which ones output the number 1, and number 0.
  4. Connect the '1' pins with a switch. Then the '0' pins with a switch. Easy.
    In this one, the keys both share a common pin.
    wires wires
  5. Use a knife to cut out holes in the lunch box just big enough to put the switches in. Connect the wires. Solder them if youre paranoid, but nothing really moves about much inside. Might want to glue the buttons to the box, depending on how well they fit in.
    wires
  6. Use a scrawny little marker to write 1 and 0 on the keyboard so you dont get confused.

A homemade binary keyboard. Magic.

If you're on a proper operating system, use this code to display the, with a nice little bit of caching.
You could also hack xterm. Details if I ever do it.

You can also extend this further and make a whole keyboard. The principal is the same, but who has 102 buttons lying about?
Code follows:
#include <stdio.h>
#include <termios.h>
#include <unistd.h>

int main(){
        struct termios termset;
        tcgetattr( STDIN_FILENO, &termset );
        termset.c_lflag &= ~( ICANON | ECHO );
        tcsetattr( STDIN_FILENO, TCSANOW, &termset );

        register int i;
        unsigned char c,t;
        for(;;){
                c='\0';
                for(i=0;i<8;i++){
                        c<<=1;
                        t=getchar();
                        c+=t-'0';
                        putchar(t);
                }
                for(i=0;i<8;i++)
                        printf("\b \b");
                printf("%c",c);
        }
}