Simulator pannel need help!

Hello all,

I’m trying to use an Arduino MEGA 2560 R3 card as main board to create a simulator panel : 35 Buttons and some output leds!
I managed to do something similar with a teensy board without any problem.
The teensy board is used has a joystick AND a serial COM port in the same time so i send simulator data’s to my teensy board through COM port.
i need to do the same thing with my MEGA but i think i do something wrong because windows don’t want to recognize my joystick and my com port, it’s the joy OR the COM port never both at same time!

i add my firmware code if anyone can have a look and give some clues.
Thanks by advance.

a10cufc.rar (31.3 KB)

You could build something like the attached photos of a simulator I built for a software emulator.
I can’t help you with your joystick problem but if you need more I/O lines you could use a PCF8574 chip. (see attached datasheet).

PCA8574_PCA8574A.pdf (1010 KB)

PCF8574.pdf (132 KB)

The number of IO's is not a problem i use multiple Arduino cards, the problem is more the abaility to enable COM port on the joystick.

I'm not quite following how these devices are connected together, but I think you're saying you're using your Mega as a USB client to emulate a usb serial port and USB joystick at the same time. I haven't done this (and don't have a Mega to do it on) but I guess that you'd need to reprogram the ATmega16U2 to present multiple devices when enumerated. Is that what you did?

DON'T USE YOUR USB port on you mega OR pin-0 & pin-1 (Rx, Tx) because those are used for PC communication.
USE YOUR THREE EXTRA SERIAL PORTS (PINS 14 -19)

I dont want to add an external com port i want to use only the USB cable and use it as a com port and a joystick with only one cable plugged.
i have already done that with a teensy board so i'm pretty shure that it's possible with the arduino but can't make it work properly.

Just to show the kind of thing i have done with my teensy board, just the USB cable plugged.

Don't know if that is possible with a Mega. I thought the USB was a SLAVE port not a HOST.

so is ther any other way to send data from the computer to the arduino board without using other extra connectors?

Tell me again why you don't want to use the 3 OTHER serial ports already built into the mega on pins 19 to 14.

Because i want to make my panel as simple to connect as possible, and because my computer doesn't have any external serial port.

icemaker:
so is ther any other way to send data from the computer to the arduino board without using other extra connectors?

If you want to have the ATmega16U2 present multiple devices when enumerated, I think you'll need to reprogram it to do that.

The low tech approach would be to use a separate Arduino for each device and connect them via a USB hub. It's crude, but gives you a trivially easy solution without needing you to understand how USB works.

icemaker:
Because i want to make my panel as simple to connect as possible, and because my computer doesn't have any external serial port.

If you get a USB-TTL cable (also known as an FTDI cable) you can connect one of the extra USARTs to another USB port on your PC.

...R

PeterH:
If you want to have the ATmega16U2 present multiple devices when enumerated, I think you'll need to reprogram it to do that.

It's my point since the begining.
I think my issue is only in the descriptor but i'm not skilled enough to figure out where, so that's why i ask for help.
Anyway if i can't figure out with arduino MEGA i'll use teensy boards tha i know they can do the job as required.
But before that i'll digg more deeply to find the way to use my MEGA boards.

If you get a USB-TTL cable (also known as an FTDI cable) you can connect one of the extra USARTs to another USB port on your PC.

That's the way I would go. Why waste time fiddling around with other methods when the solution is only one click away ?