Joystick inputs seem mixed-up in Gameduino example


rupello

Recommended Posts

I'm a newbie trying out the Gameduino samples and having a problem with my joystick, which I think is a clone of the old Atari 2600 style.

 

When I run the joytest sample my left, right, and back work OK, but the 'forward' direction gets triggered by the orange button, and moving the stick forward has no effect. I've tried a few different pin numbers at random without any success. In trying to debug this I am struggling to understand how the pins in the code below relate to the pin numbers in the hardware guide. http://papilio.cc/index.php?n=Papilio.ClassicComputingShield#joystick

 

 

void loop()
{
  GD.putstr(40, 10, digitalRead(5) ? "-" : "F");   // maps to my orange button
  GD.putstr(40, 20, digitalRead(6) ? "-" : "D");   // works
  GD.putstr(35, 15, digitalRead(7) ? "-" : "L");   // works
  GD.putstr(45, 15, digitalRead(8) ? "-" : "R");   // works 
 
  //GD.putstr(17, 24, digitalRead(2) ? "-" : "S"); // always on (if I un-comment this)
 

 

Any insights appreciated,

 

Rupert

Link to comment
Share on other sites

I havent used gameduino yet

 

and i know you marked some as // works, but try it to see what happens.

       GD.putstr(40, 10, digitalRead(13) ? "-" : "F"); 

  GD.putstr(40, 20, digitalRead(11) ? "-" : "D"); 
  GD.putstr(35, 15, digitalRead(9) ? "-" : "L");  
  GD.putstr(45, 15, digitalRead(8) ? "-" : "R");  
 
  GD.putstr(17, 24, digitalRead(12) ? "-" : "S"); // fire button?
 
 
Link to comment
Share on other sites

OK - I looked at the circuit diagram and see that only four of the joystick switches are mapped - no FWD for some reason - and the joytest example has the pins mixed-up which confused me further

 

https://dl.dropboxusercontent.com/u/138749/perma/joystick-pins.png

 

You should definitely check-out the gameduino though as it is awesome. I came down this rabbit-hole trying to get the frog to move properly in the frogger tutorial so I should be able to fix that now!

Link to comment
Share on other sites

OK - here is a patched version of the frogger tutorial for those that are interested:

 

1) change #include for gameduino
2) fix deprecated type
3) re=map joystick pins (need to use the 'fire' button to jump forward)
4) add #include for gameduino circuit

 

https://github.com/rupello/frogger-papilio-duo-gameduino/commit/cbb2314be7f2e4703d28c58e927d9f54349115cb

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.