KeyRace - FEZ Domino USB Host Demo

Special thanks:
The guys at TinyClr.com was going to send me a free Panda, but when they saw that I already ordered one, they sent me a free FEZ Domino instead! WOW! Freakin’ awesome! :slight_smile:
Thanks Gus, Robert, and Joe!

The first thing I noticed was that Domino has USB Host capability.
I believe, Domino is the least expensive microcontroller capable of USB Host.
And being a FEZ, it was Freaking’ EZ to use!

First, you subscribe to keyboard connect and disconnect events:

USBHostController.DeviceConnectedEvent += DeviceConnectedEvent;
USBHostController.DeviceDisconnectedEvent += DeviceDisconnectedEvent;

In DeviceConnectedEvent handler, register a CharDown event handler:

kbd = new USBH_Keyboard(device);
kbd.CharDown += new USBH_KeyboardEventHandler(kbd_CharDown);

That’s it! That’s Freakin EZ!!
Now, everytime you press a key on the keyboard, kbd_CharDown event handler would be called and you can do whatever you want with the keypress.

void kbd_CharDown(USBH_Keyboard sender, USBH_KeyboardEventArgs args)
{
   char typedChar = args.KeyAscii;

Here’s something I threw together yesterday. It should give you a taste of what’s possible when you have a full-size keyboard on a microcontroller. I imagine it won’t take much to create your own personal stand-alone twitter device.

Video:
[url]KeyRace - FEZ Domino USB Host Demo - YouTube

Code available at NETMFProjects:
(link removed)

Great demo … what were you using for the sound effects?

-Eric

Thanks!
I use a RadioShack 273-091 Piezo speaker. It is connected to D5 and ground.
I wrapped PWM class in a Piezo class to drive that pin. I implemented GoodSound(), BadSound(), WinSound() etc to play various PWM frequencies.

public void GoodSound()
{
    for (int i = 0; i < 5; i++)
    {
        pwm.Set(1000 + i * 100, 50);
        Thread.Sleep(20);
    }
    pwm.Set(0, 0);
}

Video + wiki for a cool project, 500 points :slight_smile: thanks

Looks like the game shipped with the emx demo. Anyway very cool! ;D

Cool. So can you just re-send those keys to USBClient to forward to PC?
I remeber Gus had some sample on this to play a trick, but can’t remember where I saw that. tia