Jump to content

Arduino MEGA 2560?


Recommended Posts

You need find a code for MEGA2560 with support for Shift Register or write your own code.

 

But for a cheap ($5) Arduino PRO Micro (or any Arduino based on AMEGA32u4) you have the ready to use code MMJoy2, that allow use two types of shift Register - CD4021 or 74HC165 and support up to ~120 buttons.

Link to comment
Share on other sites

When the inputs exceeds the io pins of the target ic you are going to need an encoder, shift register or some other way of multiplexing no matter what, you can only create as many physical connections as the ic has io pins after all

 

My choice would be to use 8 bit encoders, they are easier to work with than shift registers and works perfectly for this application

 

Sent from my E5823 using Tapatalk


Edited by Myrsnipe
Link to comment
Share on other sites

For have 32 buttons or you use a Diode Matrix (e.g. 6x6 require 12 input pins in Arduino) or an Shift Register (require 5 inputs pins in Arduino)- what requires manufacturer an extra PCB (think that Rel4y sell ready to use Shift Register PCB), probable no Arduino card have sufficient inputs pins for 32 buttons, like Myrsnipe say.

 

Encoder's don't allow you use 32 buttons in a few pins Arduino card, because each encoder require 2 inputs pins (plus a common), essentially they are two buttons, and will be limited to available pins like ordinary switches.

Link to comment
Share on other sites

It's been a while since (5 years) since last I made circuits, but am I was under the impression that 8 bit encoders took 8 inputs and had 3 outputs (since you can represent 8 with 3 bits), and that you could combine them to do 4-16 or 5-32 in this case

 

Sent from my E5823 using Tapatalk

Link to comment
Share on other sites

You could, I even considered it in assembler still might, but look at either the solution from Sokol1_br or another from Leo Bodnar and there are others already out there with support software. :D

 

Using a diode matrix would involve doing some basic scan output and read input either using an entire port for read and another for write in c/c++ or you could be a little more creative in assembler however the CPU's have a large number of i/o ports anyway.

Control is an illusion which usually shatters at the least expected moment.

Gazelle Mini-gun version is endorphins with rotors. See above.

 

Currently rolling with a Asus Z390 Prime, 9600K, 32GB RAM, SSD, 2080Ti and Windows 10Pro, Rift CV1. bu0836x and Scratch Built Pedals, Collective and Cyclic.

Link to comment
Share on other sites

  • 2 weeks later...

My understanding is that the Arduino MEGA 2560 R3 ATMEGA16U2 ATMEGA2560-16AU Board has 54 digital input/output pins and 16 analog inputs. If so why would a 8 axis with 32 button (typical Windows joystick) Sketch need to use a button matrix or shift registers? I am an Arduino newbie so I am a bit confused.

Link to comment
Share on other sites

My understanding is that the Arduino MEGA 2560 R3 ATMEGA16U2 ATMEGA2560-16AU Board has 54 digital input/output pins and 16 analog inputs. If so why would a 8 axis with 32 button (typical Windows joystick) Sketch need to use a button matrix or shift registers? I am an Arduino newbie so I am a bit confused.

 

Yes and No, It depends on how and what ports you use and how you configure the ports, some ports and pins have multiple functions.

 

If you think about it for 32 switches in a Grip would mean at least 32 individual wires and returns a 3 or 4 minimum (you wouldn't use 32 returns) row and column scanning can make the wiring easier.

 

Depending what your requirements are, using bus tristate latches and using a port as a data bus and another as an address bus would allow up to 16 * 74c922's (16 button keypad encoder) then as Mrsnipe suggested. Using a 1 of 8 decoder hence 3 bit's plus a couple bits on the same port to do read write /control and interrupt and chipselect and still leave a lot of ports available for uarts PWM outs and other functions.

 

I just thought I'd stop at 16*16 buttons. ;)

Control is an illusion which usually shatters at the least expected moment.

Gazelle Mini-gun version is endorphins with rotors. See above.

 

Currently rolling with a Asus Z390 Prime, 9600K, 32GB RAM, SSD, 2080Ti and Windows 10Pro, Rift CV1. bu0836x and Scratch Built Pedals, Collective and Cyclic.

Link to comment
Share on other sites

Sure, you can fly another and new approach. But you have to develop all / most of the software from scratch.

 

My suggestion is based an existing package and use just a small part of it.

Saves time for programming/developping and though results in more flying time. ;)

 

Yep I ended up just buying a Leo Bodnar USB interface, mind you I went down the same path bought a 2560 downloaded Atmel Studio so I could use assembler, started to read the Microsoft USB protocol manual thought about it and flying time won out. :D

Control is an illusion which usually shatters at the least expected moment.

Gazelle Mini-gun version is endorphins with rotors. See above.

 

Currently rolling with a Asus Z390 Prime, 9600K, 32GB RAM, SSD, 2080Ti and Windows 10Pro, Rift CV1. bu0836x and Scratch Built Pedals, Collective and Cyclic.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...