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.
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).
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.
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.
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.