Small Arcade Joystick (product 480)

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Small Arcade Joystick (product 480)

Post by adafruit_support_bill »

Add this to your code after the digitalRead statements. Then look at the output on the Serial Monitor when you move the joystick.

Code: Select all

Serial.print("1-");
Serial.print(state1);
Serial.print(" 2-");
Serial.print(state2);
Serial.print(" 3-");
Serial.print(state3);
Serial.print(" 4-");
Serial.print(state4);

User avatar
mscholl
 
Posts: 11
Joined: Tue May 30, 2017 12:58 pm

Re: Small Arcade Joystick (product 480)

Post by mscholl »

I keep getting an error message saying that serial doesnot have a name type

User avatar
mscholl
 
Posts: 11
Joined: Tue May 30, 2017 12:58 pm

Re: Small Arcade Joystick (product 480)

Post by mscholl »

oops that would be serial does not name a type

User avatar
mscholl
 
Posts: 11
Joined: Tue May 30, 2017 12:58 pm

Re: Small Arcade Joystick (product 480)

Post by mscholl »

Ok, got it going, but there is a never ending line going really fast with repeating "4-0-1 3-1 2-1 " It does not appear to change numbers when I press the joystick......

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Small Arcade Joystick (product 480)

Post by adafruit_support_bill »

Change the last "print" to a "println"and add a delay. That should make the output easier to follow:

Code: Select all

Serial.print("1-");
Serial.print(state1);
Serial.print(" 2-");
Serial.print(state2);
Serial.print(" 3-");
Serial.print(state3);
Serial.print(" 4-");
Serial.println(state4);
delay(250);

User avatar
mscholl
 
Posts: 11
Joined: Tue May 30, 2017 12:58 pm

Re: Small Arcade Joystick (product 480)

Post by mscholl »

at rest and when I push the joystick forward I get: 1-1 2-1 3-1 4-0
when I push backward, I get 1-1 2-0 3-1 4-0
when I want to go right I get 1-0 2-1 3-1 4-0
when I want to go left I get 1-1 2-1 3-0 4-0

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Small Arcade Joystick (product 480)

Post by adafruit_support_bill »

So switch #4 seems to be stuck closed. Double check your wiring. Make sure you don't have any short-circuits and everything is connected to the right pins.

User avatar
mscholl
 
Posts: 11
Joined: Tue May 30, 2017 12:58 pm

Re: Small Arcade Joystick (product 480)

Post by mscholl »

I wired a different digital joystick and still no success. So then I took the wire to pin13 and moved it to pin 6. (seem to remember reading that pin13 is "special") Then I switched out pin 13 in the program for pin 6. AND IT WORKED!!!! But only in 3 directions, and the last was wanting to turn, but not well. I added the extra battery pack, since it did not seem like I was getting enough power with just the USB plugged in, and now it works in all directions. Now I just need to figure out how to hard wire it in.....So what is funky about pin13? Thanks for all your help!

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Small Arcade Joystick (product 480)

Post by adafruit_support_bill »

Pin 13 on many Arduinos is connected to the on-board LED. That can affect readings when in INPUT mode.

Good to hear it is working for you now. Thanks for the follow-up.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”