{"id":159,"date":"2013-03-07T19:15:25","date_gmt":"2013-03-08T03:15:25","guid":{"rendered":"http:\/\/robertbyam.com\/ces\/?p=159"},"modified":"2025-03-18T14:26:19","modified_gmt":"2025-03-18T22:26:19","slug":"failure-and-success","status":"publish","type":"post","link":"https:\/\/robertbyam.com\/ces\/2013\/03\/07\/failure-and-success\/","title":{"rendered":"Failure and Success"},"content":{"rendered":"<p>Well, in one sense, I have failed.\u00a0 Caleb had finally reached the point where if the CES was complete, he could use it.\u00a0 And it wasn&#8217;t there.\u00a0 I thought I had more time before he got to this point, but I guess he&#8217;s growing up too fast.\u00a0 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.<\/p>\n<p>But, this sparked a mad rush of many late nights of coding and lost sleep working on the core CES software, but I&#8217;m proud to say, I have succeeded and it is now in a state usable by Caleb!\u00a0 Here&#8217;s a screenshot of the main screen:<\/p>\n<p><a href=\"http:\/\/robertbyam.com\/ces\/wp-content\/uploads\/2013\/03\/ces_screen_first.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-160\" title=\"CES First Screenshot\" src=\"http:\/\/robertbyam.com\/ces\/wp-content\/uploads\/2013\/03\/ces_screen_first-400x225.jpg\" alt=\"CES First Screenshot\" width=\"400\" height=\"225\" srcset=\"https:\/\/robertbyam.com\/ces\/wp-content\/uploads\/2013\/03\/ces_screen_first-400x225.jpg 400w, https:\/\/robertbyam.com\/ces\/wp-content\/uploads\/2013\/03\/ces_screen_first-1024x576.jpg 1024w, https:\/\/robertbyam.com\/ces\/wp-content\/uploads\/2013\/03\/ces_screen_first.jpg 1920w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>The CES acquires all the joysticks in the system, so Caleb can use the NES gamepad to navigate and choose a game.\u00a0 Once a game is selected, it releases all the joysticks and then launches the emulator for that game, in full screen mode.\u00a0 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.<\/p>\n<p>But Caleb also needed to be able to switch games.\u00a0 I originally planned to use the Reset button on the front of the NES to exit a game.\u00a0 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.\u00a0 What did I connect it to?\u00a0 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).\u00a0 This Teensy is not a joystick, but rather a standard keyboard.\u00a0 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).\u00a0 So Caleb can choose a game, play it, and push the button to close it and pick another game all by himself now.<\/p>\n<p>I had to add one more thing to this version.\u00a0 Caleb has been playing flash games on Nick Jr.&#8217;s website recently.\u00a0 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.\u00a0 It&#8217;s not much different from an emulator &#8211; an executable is launched with the game as the parameter, or in this case a website.\u00a0 So I have it launch Firefox in fullscreen mode to the flash application, and it works beautifully.\u00a0 The &#8216;Reset&#8217; button closes it too.<\/p>\n<p>There&#8217;s just one more thing left.\u00a0 The flash games use a keyboard and mouse to play.\u00a0 So I wrote a special background service that runs when a flash game is launched.\u00a0 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.\u00a0 Fortunately, all the games on Nick Jr. use the spacebar as their button.\u00a0 Pressing the select button on the NES Gamepad switches it into mouse mode, so he can play mouse games too!\u00a0 The arrow buttons on the gamepad move the mouse cursor, and the A button does a mouse click.\u00a0 With some help and practice, Caleb has been able to understand how to switch in and out of mouse mode.\u00a0 That&#8217;s pretty good for a 2 1\/2 year old!<\/p>\n<p>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.\u00a0 The biggest problem now is keeping his daily &#8216;TV Time&#8217; under his 2 hour limit \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, in one sense, I have failed.\u00a0 Caleb had finally reached the point where if the CES was complete, he could use it.\u00a0 And it wasn&#8217;t there.\u00a0 I thought I had more time before he got to this point, but I guess he&#8217;s growing up too fast.\u00a0 He was able to play Excitebike, Fisher Price [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":3,"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":204,"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/posts\/159\/revisions\/204"}],"wp:attachment":[{"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robertbyam.com\/ces\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}