Introduction: Arduino Leonardo/Micro As FSX/Flight Sim Panel
Components needed:
- Arduino Leonardo/Micro
- Toggle switch/push button
- 10k Resistor for every switch/button
- Hookup wires
- Acrylic glass (optional)
- Glue (optional)
Step 1: Building the Panel (optional)
There are many ways of building flight sim panels. An easy way is to simply download this image:
http://users.skynet.be/jcordon/cockpit/dimensions/...
Print it and glue to a piece of acrylic glass. Drill the holes for your switches and screw them in place.
I also printed a mask on transparent paper to have a better backlight effect, this was made in photoshop and took some extra time.
Step 2: Wiring the Switches
This is pretty straight forward, connect the switch between 5V and your desired pin. Also add the 10k resistor to remove any impedance.
Repeat this process for every switch.
Step 3: Programming the Arduino
Download and install this library in your Arduino libraries folder:
https://github.com/MHeironimus/ArduinoJoystickLibr...
Here’s an example code for a button connected to pin 9 on the Arduino, acting as “joystick button 1”.
#include <Joystick.h
Joystick_ Joystick;
void setup() {
pinMode(9, INPUT);
Joystick.begin(); // Initialize Joystick Library
}
void loop() {
Joystick.setButton(0, digitalRead(9));
delay(50);
}
Now open up FSX and you should be able to assign your switches in Control settings.
Happy flying!