-
-
Notifications
You must be signed in to change notification settings - Fork 106
Examples Input Switch
In this tutorial you connect a switch to your Arduino Mega board. The switch will be configured in such a way that you control the parking brake of your aircraft in the simulator. Therefore you set the correct value at an FSUIPC offset.
First, you'll see how to electronically connect the switch. Then the configuration of the software is explained step by step.
The tutorial extends the LED Tutorial - if you haven't done it yet this might be a good moment. In the schematic pictures the LED shows up.
The connection of the switch can be done directly at one of the pins of your arduino Mega board.
In this example a switch is connected to "pin 40" and "GND".
After starting MobiFlight Connector you'll see the main window with an overview of your current configurations. In this example nothing is configured so far.
Open the settings dialog, so that you can configure the MobiFlight-Board correctly. It must know at which pin a certain device is connected - in this case our switch.
Click Extras > Settings > MobiFlight Modules-Tab
Choose the desired MobiFlight Board from the tree view at the left.
In the toolbar below the tree view, different actions are available. To add a switch click "New Device" > "Switch".
You can also right-click above the module in the tree view. A context menu comes up which offers the same option (see screenshot)
A switch has been added to your module.
On the right side you can configure device specific options.
For a switch there are only two things
- Pin - this is the pin where the switch is connected at - in this case pin 40
- Name - you can assign a meaningful name to the switch. This name is later used for configurations and makes it easier for you. In this example we go with the default name "Button"
Changes are currently only made in the tree view. The module has not yet received the new configuration. Let's do that now.
Upload the current configuration to you module by clicking the upload-button on the very left of the toolbar.
A message appears if the upload was successful. Now your MobiFlight board knows what to do even if you reset it or power off.
You can now close the settings dialog by clicking OK-Button. You will be back in the main window with the configuration overview - which still is empty.
Your MobiFlight Board knows now that there is a switch connected at pin 40, but you still have to assign an action to it when its pressed or released.
First, you change to the inputs-tab which contains all configurations for inputs. The list currently is empty because we have not configured anything yet.
Let's create a new configuration for the parking brake switch.
First, assign a name to the configuration by double-clicking on the description field. Name it "parking brake".
Click on the "..."-Button at the end of the row. This will open the "Input Config Wizard".
The Input Config Wizard is similar to the Config Wizard used for outputs. We had introduced it in the LED tutorial.
Change to the "Input"-Tab since we don't need any preconditions for our configuration.
Choose your connected module from the "Module"-DropDown-list.
Choose your configured switch from the "Device" drop down list.
Once you have selected your switch, the input setting section will update accordingly and offer assignment options for your switch.
A switch allows to assign different actions for the "On press" (you have pressed or closed it) and "On release" events (you have released or opened it). The parking brake state will be set via a FSUIPC offset.
Hence, at "Input Settings" > "Action type" you choose "FSUIPC Offset".
Select the preset "General - Parking Brake" from the preset list.
Click "use"-Button next to the DropDown-Field to confirm.
Now nearly all settings are automagically set. But, the actual value that shall be set at the FSUIPC offset once you toggle the switch is still missing. The FSUIPC offset value must be "1" if the parking brake is set, "0" if it is released.
Therefore, put the value "1" in the field "Value".
Your settings should now look like the following:
Go to the "OnRelease"-Tab and perform the same steps there.
This time, use 0 in the "Value" field.
Close the "Input Config Wizard"-Dialog by clicking the "OK"-button.
As a last step you have to activate your config row. Click the checkbox at the beginning of the row. Only active configuration rows are later executed.
Start your favourite flight simulator, e.g. Microsoft Flight Simulator X or x-plane.
Load and start your flight.
Wait a moment until the FSUIPC connection becomes established. You can see the status of the connection in the status bar indicated by the green symbol.
Let the MobiFlight Connector run, by clicking the "Start"-Button in the toolbar.
Now toggle your switch and set and release the parking brake with it. Your switch and the parking brake are always in sync. That's cool isn't it?
If you have also done the Tutorial - The 1st LED and your config is still active, then this should do well together. The LED turns on and off accordingly.
You have successfully configured your first switch and you have controled the value of an FSUIPC offset. Go ahead and try out more stuff, like settings lights, fuel pump or your engine starter.
Tell us on the forum about your progress and your project. We are looking forward to your feedback!
- MobiFlight Connector Installation
- Mobiflight Connector BETA version installation
- Modules
- MobiFlight Connector Files Structure
- MobiFlight Connector Uninstall
- Modules Reset to factory default
- Verifying the WASM module installation and locating the MSFS2020 community folder
- Verifying the WASM module installation and locating the MSFS2024 community folder
- Using a Winwing FCU with MobiFlight
- Providing logs from MobiFlight
- MobiFlight Connector How does it work
- Mobiflight Connector Main Window
- Flash module with MobiFlight firmware
- Input and Output devices
- Joysticks
- Midi Boards
- Sim Variables (for Output)
- Input Actions
- Merging configuration files
- Disabling specific COM ports
- Examples Output LEDs
- Examples Input Switch
- Example 7 segment display
- Example Servo motor
- Controlling LEDs with an output shift register
- Adding lots of buttons with an input shift register
- Beginner's guide to input multiplexers
- Key Matrix with standard MobiFlight and Multiplexers
- Tutorial Easy Driver and x.27 or x.40 Stepper Motor
- Tutorial for Airbus VS display via 7-Segment LED Module
- Example Analog Input Potentiometer
- Baron G58 Tutorial Gear, Flaps, Mags, ELT Input Output Programming
- Using Mobiflight to control arduino-based 3rd party panels (RealSimGear GNS530)
- How to use a VNH2SP30 DC motor shield with MobiFlight
- Using 3D printer mainboards
- Playing sounds by sending keystrokes to AutoHotKey
- Using the selector knob on a Honeycomb Bravo
- Using an adjustable 12 position switch as a GA starter
- Brightness of LCD displays with I2C
- Using three-position switches
- Transponder with one Rotary
- MSFS2020 RPN Tips and Tricks
- MSFS2020 Using the Custom Input Code Box
- MSFS2020 Install WASM module and Event List
- MSFS2020 How to Create and Use User Defined Lvars
- MSFS2020 How to Create a Blinking LED configuration
- MSFS2020 User Defined WASM Module Events Best Practices
- MSFS2020 Developer Mode, Model Behavior dialog and Console window
- MSFS2020 PMDG 737‐700 List of Events that require use of FSUIPC7
- MSFS2020 PMDG 737‐700 Calibrate throttle idle and reverse thrust using interpolation (Valkyrie)
- MSFS2020 PMDG 737-700 Chrono unit functions implemented in Mobiflight
- Configuring PMDG 737 Parking Brake Lever Auto-Release with a Servo in Mobiflight
- Using encoder to drive a value back and forth within a given range
- Adding a custom board to MobiFlight
- User guide - Community Board and Custom Devices
- Developing your own custom devices/boards