[NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Various user-contributed guides for hardware-related things
nonameboy
Posts: 6
Joined: Sat Nov 12, 2016 12:17 am
Has thanked: 3 times
Been thanked: 1 time

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by nonameboy » Mon Dec 05, 2016 1:13 am

sotasystems wrote:
nonameboy wrote:
sotasystems wrote:
Yes it possible with a slight modification, but it's peanuts :)
ok thanks. have to take a look. I'm not a pro coder but I think I can do it. If not, can I send you the modified version of your code so you can take a look? Of course if you have time ;-)
I just noticed that it unfortunately is not possible. :?

If we take a look at [mention]banjokazooie[/mention]'s Teensy diagram here:

Image

We can see that he uses 21 Pins. The Leonardo only offers 18 maximum. So if you plan on using all of them, you can't. If you are okay with leaving specific ones out, it will work.

An alternative: If I were to use a Wii U gamepad with a Leonardo I would leave out these inputs:

- Analog stick Thumbclicks (2x)
- TV
- Home

That would leave you with 14 buttons and 2 analog sticks, which would work out.
That sounds good I can live with that. Thank you very much for helping with the wiring diagram :)

User avatar
sotasystems
Posts: 160
Joined: Sun Oct 09, 2016 4:56 am
Location: Germany, 127.0.0.1
Has thanked: 95 times
Been thanked: 93 times
Contact:

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by sotasystems » Mon Dec 05, 2016 9:04 am

nonameboy wrote:That sounds good I can live with that. Thank you very much for helping with the wiring diagram :)
Then this is for you:

Image
Ladies and gentlemen, I would like to inform you that I am currently moving very far away, and therefore I am very busy.

UPDATE: I am still alive! My ISP is setting up my internet on the 19th of January at my new place, explaining my offline-ness.

If you write me a PM, I will very likely take some time to respond.

Also, my 2nd build will soon go on, so if you've been following it, please stay tuned! :)

Many thanks for your understanding!

nonameboy
Posts: 6
Joined: Sat Nov 12, 2016 12:17 am
Has thanked: 3 times
Been thanked: 1 time

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by nonameboy » Tue Dec 06, 2016 5:20 am

sotasystems wrote:
nonameboy wrote:That sounds good I can live with that. Thank you very much for helping with the wiring diagram :)
Then this is for you:

Image
Thanks again sota. I will test when I have time and post here some pictures
edit: so all pins are yoused? No space for the home button I think

User avatar
sotasystems
Posts: 160
Joined: Sun Oct 09, 2016 4:56 am
Location: Germany, 127.0.0.1
Has thanked: 95 times
Been thanked: 93 times
Contact:

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by sotasystems » Tue Dec 06, 2016 5:38 am

nonameboy wrote: Thanks again sota. I will test when I have time and post here some pictures
edit: so all pins are yoused? No space for the home button I think
Yes, all pins are used. You have to leave the home button out. The home button was used to switch between joystick and keyboard mode in [mention]banjokazooie[/mention]'s build, so if you intended to use it for the same purpose, it is not too bad to leave it out.
Ladies and gentlemen, I would like to inform you that I am currently moving very far away, and therefore I am very busy.

UPDATE: I am still alive! My ISP is setting up my internet on the 19th of January at my new place, explaining my offline-ness.

If you write me a PM, I will very likely take some time to respond.

Also, my 2nd build will soon go on, so if you've been following it, please stay tuned! :)

Many thanks for your understanding!

Kingoddball
Posts: 3
Joined: Thu Dec 01, 2016 1:35 pm
Has thanked: 1 time

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by Kingoddball » Mon Dec 19, 2016 2:44 pm

Hello all :)

I'm wondering if someone can post a working copy of gamecontroller.ino:
Could someone paste the raw text in a post or attach the file?

It seems like the gamecontroller.ino file from mediafire is missing a chunk of the file.

It starts at line:
JoyState_t joySt; // Include joySt

I have tested this on Win/OSX and downloaded many times with this same issue.

I cannot verify the code from here as it throws the error of:

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Mac OS X), Board: "Arduino Leonardo"
Gamecontroller:1: error: 'JoyState_t' does not name a type
Gamecontroller.ino: In function 'void setup()':
Gamecontroller:100: error: 'joySt' was not declared in this scope
Gamecontroller.ino: In function 'void loop()':
Gamecontroller:311: error: 'joySt' was not declared in this scope
Gamecontroller:326: error: 'Joystick' was not declared in this scope

User avatar
JujuPi
Posts: 51
Joined: Mon Nov 21, 2016 2:08 am
Has thanked: 8 times
Been thanked: 16 times

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by JujuPi » Tue Dec 20, 2016 3:43 am

Hey Sota I am having an issue with the analogue buttons. I have one working completely fine. Ie the left side one near the select button. However the one in the middle does this on my windows Game controller menu:

https://i.gyazo.com/33fb4db24f4fa0cbc7a ... 44bc92.gif

It is only doing figure 8s rather than going around in a circle as the other would do. Is this normal?

User avatar
sotasystems
Posts: 160
Joined: Sun Oct 09, 2016 4:56 am
Location: Germany, 127.0.0.1
Has thanked: 95 times
Been thanked: 93 times
Contact:

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by sotasystems » Fri Dec 23, 2016 2:52 pm

JujuPi wrote:Hey Sota I am having an issue with the analogue buttons. I have one working completely fine. Ie the left side one near the select button. However the one in the middle does this on my windows Game controller menu:

https://i.gyazo.com/33fb4db24f4fa0cbc7a ... 44bc92.gif

It is only doing figure 8s rather than going around in a circle as the other would do. Is this normal?
Hmmm... it looks like a mismatched wire to the analog stick somewhere to me.
Can you make a wiring diagram? And also, what analog stick are you using? :)
Ladies and gentlemen, I would like to inform you that I am currently moving very far away, and therefore I am very busy.

UPDATE: I am still alive! My ISP is setting up my internet on the 19th of January at my new place, explaining my offline-ness.

If you write me a PM, I will very likely take some time to respond.

Also, my 2nd build will soon go on, so if you've been following it, please stay tuned! :)

Many thanks for your understanding!

User avatar
JujuPi
Posts: 51
Joined: Mon Nov 21, 2016 2:08 am
Has thanked: 8 times
Been thanked: 16 times

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by JujuPi » Thu Dec 29, 2016 8:21 am

sotasystems wrote:
JujuPi wrote:Hey Sota I am having an issue with the analogue buttons. I have one working completely fine. Ie the left side one near the select button. However the one in the middle does this on my windows Game controller menu:

https://i.gyazo.com/33fb4db24f4fa0cbc7a ... 44bc92.gif

It is only doing figure 8s rather than going around in a circle as the other would do. Is this normal?
Hmmm... it looks like a mismatched wire to the analog stick somewhere to me.
Can you make a wiring diagram? And also, what analog stick are you using? :)
Looks like it is working atm. Not sure why it shows that on windows. Works on the gameboy atm :)

coryh83
Posts: 3
Joined: Wed Jan 04, 2017 10:46 am

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by coryh83 » Sun Jan 15, 2017 12:37 pm

First off Thanks Sota for this great guide. I just converted a SNES controller to usb using the pro micro and it worked perfect.( well almost. I soldered 2 of the buttons backwards. easy fix in the code). it works great in emulation station. I have a question about how the code will communicate in the backend setting menus. after selecting a rom there a few seconds where you can click to configure how the rom runs. Once you are in that menu the code then stops working. I then had to plug in a keyboard to get back into emulation station where the code began working and recognizing the button presses again. Is there a way to reconfigure the button presses to coincide with key presses. This is my first foray into Arduino so there is probably something I missed. Thanks for this great communty and I look forward into detailing about my build soon.

marcushg
Posts: 37
Joined: Thu May 19, 2016 4:11 pm
Has thanked: 5 times
Been thanked: 4 times

Re: [NEW VERSION] Sota's 14 buttons + optional up to 2 analog sticks guide for a Leonardo Pro Micro (Teensy alternative)

Post by marcushg » Fri Jan 27, 2017 4:43 pm

I can't get it to work. I've been following all the steps from the guide but no way...
Arduino 105r2 (windows 10) says this when i try to open gamecontroller.ino

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at processing.app.Sketch.setCurrentCode(Sketch.java:1182)
at processing.app.Sketch.load(Sketch.java:220)
at processing.app.Sketch.<init>(Sketch.java:142)
at processing.app.Editor.handleOpenInternal(Editor.java:2191)
at processing.app.Editor.<init>(Editor.java:304)
at processing.app.Base.handleOpen(Base.java:705)
at processing.app.Base.handleOpen(Base.java:670)
at processing.app.Base.handleOpenPrompt(Base.java:659)
..... etc

I have also tried to open the code through notepad++ and paste it in a new sketch and try to burn it as sparkfun pro micro 5v/16mhz and but i'm not sure if it is working as expected, now the light is staying in red and shows as a multiple hid device keyboard, mouse and gamepad. The gamepad shows pov is staying always pressed up, and rotation x an y all the way to the right and the other parameters to the left, then the buttons from 1 to 14 work. Should the red light be always on? I read that the red light on made the gamepad hid lag a bit an not to register all button presses...

Anyway thanks for the post, the code, the guide and all the help

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest