Examples Output LEDs - MobiFlight/MobiFlight-Connector GitHub Wiki

Let's start

In this tutorial you connect a LED at the Arduino Mega. The LED is configured in such a way that it is in sync with the status of your parking brake. We therefore use the appropriate FSUIPC offset. The LED shines if the parking brake is set and turns off the moment you release the brake.

Sounds like fun? It is! First the electronical connection of the LED is explained. Then you'll learn step by step how to configure the MobiFlight Connector software.

Connect LED at the Arduino Mega

Connect the LED directly at one of the pins of your Arduino Mega.

It is preferred to use a resistor within this connection. The voltage of the Mega's pin is 5V as stated in the data sheet. As you can see in the schematic view, the two pins at the bottom of the pins socket is marked as "GND" - pin 54 and 55. So we use one of these pins for our GND connection.

Take care that you properly connect the anode of the LED together with the resistor at pin 22 and the cathode with GND.

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/led-example.png

Configuration of MF Connector

When you open MobiFlight Connector you'll see an overview of your current configuration. In this example we assume it is empty because nothing has been configured yet.

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/step1-open-mfconnector.png

First you must open the settings dialog, because we want to configure the MobiFlight board. It has to know that at one of it's pins an LED is connected.

Let's go there by clicking Extras > Settings > MobiFlight Modules-Tab

On the left, choose the desired MobiFlight board in the tree view - there might be more than depending on how many boards are connected.

In the toolbar below, there are different buttons to perform different actions. To add a new device like a LED, click at Add Device > LED / Output.

Now a LED has been added to your MobiFlight module. You can see an icon that represents the LED.

On the right you define additional settings depending on the type of device that you add.

When using a LED there are only two options available

  • Pin - refers to the pin's number as marked on the Arduino Board.
  • Name - you can set a name here which is used later in the tool when you assign a function of your flight sim. Use a good name which makes it easy for you to find it again. In the example we stick with the default "Output"

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/step0-upload.png

There is one step left - we have to upload the new configuration to your board. Therefore click on the upload-button on the very left of the toolbar.

A message will show up that indicates whether the upload has been successful or not. In the positive case, now your MobiFlight will remember that on Pin 22 a LED is connnected - even if you restart it or power off.

Close the Settings dialog now by clicking on OK-button. You will return to the configuration overview - which still is empty.

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/step2-add-config.png

Let's create the actual configuration for the parking brake state.

First, you assign a name to the new config entry by double-clicking on an empty row and typing it the name via the keyboard.

Click the ...-Button at the end of the row to enter the "Config Wizard"-dialog.

The "Config Wizard" shows up.

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/step3-use-preset.png

To make it easy, use one of the predefined presets from the preset list.
Look for "General - Parking Brake", select it and confirm with the "use"-Button next to the drop down field.

"Automagically" all settings regarding the FSUIPC offset are filled correctly.

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/step3-use-preset-confirm.png

Go to the "Display"-Tab

Choose your module from the list in the "display type" section

Choose "Pin" for the "Type" setting.

The settings will change accordingly.

Now from there select you your "Output"-Pin from the DropDown box labeled "Pin"

https://www.mobiflight.com/tl_files/bootstrapbase/img/tutorials/led/step3-config-display.png

Push the Test-button to confirm that everything works as expected.

You LED should turn on.

If your LED does not turn on, verify that you have it connected properly and that polarity is correct, too. It's easy to confuse anode with cathode - I can tell ;)

If the LED shines, click the Stop-Button. The LED turns off.

Close the config wizard by clicking the OK-Button.

Start your flight sim, for example Microsoft Flight Simulator X.

Start your flight.

Wait a moment until MobiFlight Connector has established a connection with FSUIPC. You can see the status in the status bar at the bottom of MobiFlight Connector.

Once your flight is loaded and FSUIPC connection has been established, start the MobiFlight Connector.
Click on the start button from the toolbar (the green triangle)

The LED should immediately turn on because the default flight normally has the parking brake set.

Toggle the state of the parking brake - you'll see the LED turning on and off accordingly!

Congratulations!

Hey, you got it right - the first experiment with the MobiFlight solution has been successful! Try out other configurations or head over to the next tutorial, where you connect a button to toggle the state of the parking brake.

Tell us in the Forum about your progress and your projects!

If you have trouble with this tutorial, start from the beginning again or ask for help on the forum also - the MobiFlight community will try to help you.

⚠️ **GitHub.com Fallback** ⚠️