Does anyone know if its possible to have an analog input to an Arduino go USB to a computer and be a mouse function, but have a toggle in the code to switch it to a joystick function? In other words I want it to have a joystick mode and a mouse mode, and be able to switch between the two.
In other words I want it to have a joystick mode and a mouse mode, and be able to switch between the two.
If you have the right kind of Arduino, this is trivial. If you don't, it is impossible.
Linus76:
In other words I want it to have a joystick mode and a mouse mode, and be able to switch between the two.
On the right type of Arduino that support native USB you can define USB HID endpoints for all three devices (Keyboard/Mouse/Joystick) to enumerate at the same time. Toggling between mouse/joystick in the USB code might be problematic but keeping all three endpoints and getting the Arduino to send data to either mouse or joystick should be fine.