Aaron Ardiri
[Valid RSS] RSS/XML feed
198 entries available (show all)

 

Internet of Things (IoT)
   

PLEASE TAKE A MOMENT TO FOLLOW MY NEW VENTURE:
 
RIoT Secure AB
 
ALL SECURITY RELATED TOPICS ON IoT wILL BE POSTED THERE


2014-05-28
>> ARDUINO - FROGGER

Komnami introduced Frogger to the world in 1981 - so much time I lost as a child!

A few days ago my Gameduino shield arrived and I decided to plug it in and tinker a little bit.

After running through the suite of demo examples; I did remember seeing that the creators of the Gameduino shield actually did a series of tutorials explaining how to convert the original classic Frogger game over the device:

For convenience and to get directly into it - I simply downloaded the final scene and compiled it within the arduino workbench - in a matter of seconds I had the game showing in glorious 400x300 resolution pixel doubled over a VGA screen to 800x600 on a TFT monitor. All I wanted to do now was play the game - so, it was time to search around see what electronics I would piece together to create some form of controller unit and interface for it.

I found a Parallax 2-axis analog controller and a breadboard shield for the arduino which would be much better than trying to wire up some crude digital switches that probably wouldn't survive the bashing the unit was about to receive. Also, the code provided assumed there that the input was digital but I had an analog controller on my hands so of course this meant making some small modifications to the code:

  • #define ANALOG_MAX    1023
    #define ANALOG_THRES  10
    
    class Controller 
    {
      public:
        void begin() 
        {
          prev = 0;
        }
        byte read() 
        {
          int val;
          byte r = 0;
    
          // process the up/down analog input
          val = analogRead(3);
          if (val > ANALOG_MAX-ANALOG_THRES) r |= CONTROL_UP;
          if (val <            ANALOG_THRES) r |= CONTROL_DOWN;
    
          // process the left/right analog input
          val = analogRead(2);
          if (val > ANALOG_MAX-ANALOG_THRES) r |= CONTROL_RIGHT;
          if (val <            ANALOG_THRES) r |= CONTROL_LEFT;
    
          byte edge = r & ~prev;
          prev = r;
          return edge;
        }
      private:
        byte prev;
    }

The complete configuration ended up nice and compact as well:

A quick recompile and making sure all my inputs were wired correctly and I would play Frogger to my hearts content and lose more valuable hours from my life. The game is in its a basic form; but someone has taken it to another extreme by building a complete game cabinet and implementing a suite of new features - someone has too much time to spare!


 

advertisement (self plug):
need assistance in an IoT project? contact us for a free consultation.

 



IoT security - Who is watching who?
 
Introducing fuffr

DISCLAIMER:
All content provided on this blog is for informational purposes only.
All comments are generated by users and moderated for inappropriateness periodically.
The owner will not be liable for any losses, injuries, or damages from the display or use of this information.