I am new to the ARDUINO community. I was able to gain some knowledge with an Adruino Micro, now that I am interested in editiing input device signals I ordered a DUE.
The DUE comes with in build host functinality and reading a connected Mouse for example was fun to watch and worked great.
Now I want to edit the received data and send it to the computer which gives me bit of a headache.
I googled quite a lot, tried different libiaries but I couldn't get anything to work.
What do I want to do?:
Basically I plug in my mouse into the default USB Port of the DUE, edit the input and send it to the computer via the programming port.
I tried to merge some examples from the Arduino website to get what I want, this is the code:
It then marks the last line "Mouse.move(move_X, move_Y, 0);" and says:
'Mouse' nicht gefunden. Beinhaltet Ihr Sketch die Zeile '#include <Mouse.h>'?
'Mouse' could not be found. Are you including '#include <Mouse.h>'?
I have not checked all the facts, but my suspicion is, what you are trying to do does not work. You only have one native USB port on the Arduino Due. You may think you have two but that is not true. The programming port is connected to another microcontroller.
You would need to change the firmware in the ATmega16U2 if you wanted it to act as a USB peripheral mouse device. Then you could talk to it with your own made-up serial protocol and make a USB mouse movement modifier.
The sketch from ard_newbie reply #7 should work as it only sends serial print information to the second microcontroller which is then send via USB to your PC using a virtual COM port.
Yes answer 7 does work, but it gives me no room for editing the mouse movement and forward it to the computer.
Are there ready to use firmware which does what I need? If not isn't it easier to buy another USB Shield and stick it on top?
I really thought the due is enough for my needs since it really sounded like it would in the description..
What you are trying to do has no application in the product world. As a product engineer you would just implement this into the USB device aka your mouse. On the other side if you had the skills, you could change the driver in the operating system (Windows or Linux) to modify the behavior towards the user application.
In USB most products are USB device, and they always connect to a USB host. Some products can be both aka smartphones but only one at a time. Host for a SD card reader and device when downloading data from a PC. The exception is USB Hubs, and they are single purpose chips not general-purpose microcontroller.
An Arduino with native USB may be a more flexible choice. You can connect them via Serial. It may not look as pretty as a shield.
Try Google. e.g., "ATmgea16U2 HID mouse" Remember that ATmega16U2 is used to program the SAM3X. If you modify it and something goes wrong, it may be a bit more difficult to get this back working.