Each simulator panel has at least a few annunciators that should be made to look "real". It seems that using LEDs is the simplest way to output information from Arduino.
Standard way to control LED in Arduino is using one digital pin as output for each one LED, using digitalWrite() function that sets chosen pin to the state 0 or 1. With the the ArdSimX, ArdSim, XPData libraries you don't need do this, they have inbuilt functions to control LEDs directly by datarefs from X-Plane.Simple connection of the low-power LEDs to Arduino output pin:
1. If you need to control a few low-power LEDs with one Arduino simply connect them to output pins (anode) and to the ground (cathode) with serial resistor (R1). This resistor can be varied from 50 to 500 ohm for common LEDs with 10-30 mA current (maximum "damage" current for Arduino I/O pin starts with 40 mA). The resistor used can vary from 50 to 500 ohm for common LEDs with 10-30 mA current. You can select a suitable resistor by trying and checking the brightness you need.
2. If you need to control a high-power LED (more than 40mA)
or several parallel LEDs with Arduino (or filament lamp), use any suitable n-p-n
transistor (or MOSFET) as power switch.
- In older ArdSim library specific function in the Arduino code was usedto control the LED with specified X-Plane dataref.
- In ArdSimX only online Configurator is used to specify the LED and X-Plane parameter that will control it. Nothing to do in Arduino code.
To minimize the usage of Arduino pins for output ArdSimX support output to the chain of the shift registers to make the output extension for several LEDs. This is a bit more complex but widely used method of LED output with Arduino. The data is transmitted to registers from one output pin of Arduino, second pin is used for strobe.
This method was used for our Baron 58 panel in the "stand-alone" Arduino program code designed specifically for this panel. Later support of this ouput extension board was added in the XPData library.