Failure and Success

Well, in one sense, I have failed.  Caleb had finally reached the point where if the CES was complete, he could use it.  And it wasn’t there.  I thought I had more time before he got to this point, but I guess he’s growing up too fast.  He was able to play Excitebike, Fisher Price Firehouse Rescue, and even a little bit of Super Mario Bros., but I would have to close the game and load up the next one every time he wanted to switch.

But, this sparked a mad rush of many late nights of coding and lost sleep working on the core CES software, but I’m proud to say, I have succeeded and it is now in a state usable by Caleb!  Here’s a screenshot of the main screen:

CES First Screenshot

The CES acquires all the joysticks in the system, so Caleb can use the NES gamepad to navigate and choose a game.  Once a game is selected, it releases all the joysticks and then launches the emulator for that game, in full screen mode.  A background service then sits and waits for the emulator executable to exit, at which point it returns to this main screen and re-acquires all the joysticks.

But Caleb also needed to be able to switch games.  I originally planned to use the Reset button on the front of the NES to exit a game.  But because the computer is not fully built yet, and Caleb might press the Power button instead at this age, I bought a simple push button and connected it instead with a long cord coming out by the front of the TV.  What did I connect it to?  Why, another Teensy of course! This teensy will sit inside the computer and connect to all the buttons on the NES case (the Reset, plus more I plan to add for things live saving and loading game state).  This Teensy is not a joystick, but rather a standard keyboard.  When the button is pushed, the Teesny sends a Control-Alt-Shift-R keypress like any other keyboard, and my software watches for this and automatically closes the running application (emulator).  So Caleb can choose a game, play it, and push the button to close it and pick another game all by himself now.

I had to add one more thing to this version.  Caleb has been playing flash games on Nick Jr.’s website recently.  But this we also had to load for him, scroll the page down to see the game, etc. So I decided to add the functionality to the CES.  It’s not much different from an emulator – an executable is launched with the game as the parameter, or in this case a website.  So I have it launch Firefox in fullscreen mode to the flash application, and it works beautifully.  The ‘Reset’ button closes it too.

There’s just one more thing left.  The flash games use a keyboard and mouse to play.  So I wrote a special background service that runs when a flash game is launched.  It reads input from the joystick (NES Gamepad with Teensy), and translates the up/down/left/right into the arrow keys on the keyboard, and it translates the button presses into the space bar.  Fortunately, all the games on Nick Jr. use the spacebar as their button.  Pressing the select button on the NES Gamepad switches it into mouse mode, so he can play mouse games too!  The arrow buttons on the gamepad move the mouse cursor, and the A button does a mouse click.  With some help and practice, Caleb has been able to understand how to switch in and out of mouse mode.  That’s pretty good for a 2 1/2 year old!

So, the bottom line is, we can now just turn the application on, give Caleb the gamepad, and he can play and switch between whichever of his games he wants without our help.  The biggest problem now is keeping his daily ‘TV Time’ under his 2 hour limit 🙂

Next Post:

Leave a Reply

You must be logged in to post a comment.

WordPress theme by LeadCamp, Inc