-
-
Notifications
You must be signed in to change notification settings - Fork 108
Controlling the brightness of LEDs and 7 segment modules
THIS IS WORK IN PROGRESS
The brightness of LEDs and 7-segment modules can be controlled inside Mobiflight. In this tutorial we will cover how to do this. However, we will not get into any details about wiring potentiometer, encoders, LEDs or 7-segment modules, as those topics are covered in other tutorials. It is assumed all hardware has been properly connected and tested.
A potentiometer or encoder can be used to set the value of either a Mobiflight Variable or a simulator Lvar in MSFS2020, or maybe a dataref in Xplane12. In many cases this value ranges from 0 to 100, which we will use as example in this tutorial. It can really be set to any arbitrary range. This value is then used to represent the brightness level for either LEDs or 7-segment displays. This value can also be used to synchronize the lights brightness in the simulator and your hardware panel.
In the case of LEDs, they need to each be connected to a PWM (Pulse Width Modulation) capable Arduino pin. This PWM signal can vary from 0 (off) to 255 (full bright). Mobiflight can control the PWM function available from some of the Arduino board pins. Please refer to your specific board pinout diagram to determine which pins have this capability. In a Uno board, for example, PWM capable pins are: 3, 5, 6, 9, 10 and 11.
For Max7219 7-segment modules, there is an onboard register that Mobiflight uses to control the brightness of the LEDs, that can vary from 0 (off) to 15 (full bright).
Potentiometer
A typical Mobiflight analog input config for a MF variable might be this simple formula in the value field to set the value in the range 0-100:
@/10.23
Bear in mind this can be an Lvar or Dataref just as well.
Encoder
In the case of an encoder, a typical input config formula for a MF variable would look like this for Left and Right. The result will again be a value in the range 0 to 100.
Left turn: Max($-5,0)
Right turn: Min($+5,100)
Note the use of the Min and Max functions to limit the upper and lower bounds (0-100).
We showed how the input with either a potentiometer or encoder can be modeled into a value range 0 to 100. This is a typical range used in the simulator for controlling panel and other lights brightness.
- 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
- Using VKB controllers 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
- Workflow for Creating Flight Simulation Panels ‐ Part 1
- 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