Some hints for Arduino + SPAD.next (FS2020)
This is for people already experienced with arduinos, but struggling to figure out how the serialdemo sketch from https://github.com/c0nnex/SPAD.neXt/tree/master/Scripts works with the limited amount of documentation.
Again, not a guide, just some important hints.
This does *not* use an arduino pro micro configured as a joystick, but any arduino using normal serial communication on a usb port. (I'm using an arduino nano)
First, this video helps explain the serial device connection and debugging: https://www.youtube.com/watch?v=Vs8Yf5Q9xNY
After uploading your sketch to the Arduino using the Arduino IDE:
In settings, go to serial devices, add new device. Select the correct com port, 115200, dtr off, 32 bit off.
Restart SPAD.next and go back to the serial devices. There should now be a device listed with a disconnect and connect button. Connect to use it with FS2020, disconnect to free the com port to upload using Arduino IDE.
Arduino sketch tips
To toggle a single switch in FS2020:
when a hardware button is pressed. (You don't have to add anything to the command list or callbacks to send SimCommands).
Some useful switches that works(toggle):
To directly control autopilot value (for example with a rotary encoder):
Add a function to the command list
kAltitude = 12, //(increment the number for each command(?))
Add a callback:
// Request Altitude Lock Dir Updates
messenger.sendCmdArg("SIMCONNECT:AUTOPILOT ALTITUDE LOCK VAR");
Send the value from the encoders. I send them 10 times per second as I don't know the performance impact of sending continously.
I don't know if this is the correct way to do it, but it works. I now have 5 rotary encoders on an arduino nano controlling the most important functions of the autopilot.
Good luck experimenting!