i have made a c++ qt creator program on my pc that will ether convert controller values, including gyro, in to mouse and keyboard or convert gyro values to a virtual controllers analog stick so that i can use gyros and the same controller on pc games or ps5 games through remote play.
Some games on ps5 have native keyboard and mouse support, but remote play cant receive mouse and keyboard values from a pc and send them to the ps5 even if the game supports it.
i have been led to believe that there are a few methods through witch 2 arduinos can communicate through there pins and that you can send values from a pc, to a arduino through there usb port.
I have 2 arduino pro micros left over from projects i dont use any more, so my idea is to send values from my pc to arduino 1 through its usb, then send values from arduino 1 to arduino 2 through there pins, then have arduino 2 output mouse and keyboard values through its usb port using the relevant libraries.
so i am looking for insight in to any part of this idea to get a general idea of how straight forward or not this will be, things to look out for and general thoughts from people who know more than i do.
How much experience do you have in writing PC programs that can read the mouse and keyboard values? You actually have to have those values in hand before you can send to your Arduino.
my programs fairly robust at this point i get values from my controller and are converted to mouse and keyboard values, so i have the values to send though i will likely have to come up with a seperate system to tell arduino 2 what keyboard presses to send bases on the output of the controller assuming this is possible.
and at this point i have a fair amount of experience with codeing mouse and keyboard and controller stuff
it was my understanding that there isnt really a way for me to send values from the pc to the arduino and output keyboard and mouse through the same usb on the arduino pro micro
Sure. Have you managed to get one Arduino which is NOT connected to your PC connected to another Arduino which IS connected to your PC using Tx to Rx and Rx to Tx (and connecting ground to ground of the two Arduinos)?
Here is a great tutorial that should help get you started. It's fire, trust me - it works if you read and follow it closely.
As for the USBHost on the Pro Micro, I can't say as I have never tried it.
One note; however, on the immortal tutorial of @Robin2 . The examples use a baud of 9600
Serial.begin(9600);
and I imagine that decision was made to make the tutorial appeal to the broadest audience possible. You should be using
Serial.begin(115200);
if the Pro Micro supports it (I didn't double check - that's up to you but I imagine it's fine).
if I got that right, @tapyourashley wants to have on one hand the arduino connected to the PC through USB and also the Arduino connected as an HID capable device to a PS5 through the same USB connection ➜ hence the issue and the idea of using a second Arduino.
On a Pro-micro, Serial refers to the USB virtual serial port (CDC over USB) and Serial1 refers to the hardware UART on pins 0 and 1. so a way to use only one Arduino would be to have the PC discuss with the Arduino by using a USB to Serial adapter connected to pins 0 and 1 and keep the USB port for the HID link to the PS5.
In addition to the USB connection, the Pro Micro has an additional UART serial port that can be used for bidirectional data transfer with the PC. (Most of the more recent Arduinos have 1 to 4 such serial ports).
With a multidrop connection (e.g. RS485) and suitable software, one serial port per Arduino can handle all the required data transfer for a relatively low speed local network.
i cant currently spend money on this, but i am assuming that this cable doesnt have anything particularly special about it after looking some of them up on ebay, alot of them just look like usb cables with a male usb and the other end has the indevidual internal wires of a usb cable with the arduino pin easy plugin adapter things on them.
so is it resonable to assume i could just sacrifice the usb cable of a old mouse or something to make my own ?
USB transmits data as differential high-speed digital signals using two lines (D+ and D–) and a complex packet protocol handled by a USB controller. It doesn’t represent bits directly as high or low voltages for each data bit.
UART TTL, on the other hand, sends each bit as a direct voltage level over a single wire: a high voltage (for example 3.3 V or 5 V) for a logical 1 and 0 V for a logical 0, timed according to the baud rate.
So the USB-to-UART converter translates between packetized, differential USB signaling and simple, time-based voltage levels used by UART.
If you don’t have one and can’t buy one, the extra Arduino can indeed play this role.