Skip to content

Controlling the brightness of LEDs and 7 segment modules

Jaime Leon edited this page Jan 19, 2024 · 21 revisions

The brightness of LEDs and 7-segment modules can be controlled inside Mobiflight. In this tutorial we will cover how to do this. We will not get into any details about wiring potentiometer, encoders, LEDs or 7-segment modules, as those topics are covered in other tutorials.

The Basic Technique

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 capable Arduino pin. See the appropriate Arduino board pinout diagram to determine which pins are capable sending a PWM signal. This PWM signal can vary from 0 (off) to 255 (full bright).

For Max7219 7-segment modules, there is an onboard register that Mobiflight uses to controls the brightness of the LEDs, that can vary from 0 (off) to 15 (full bright).

Mobiflight Input Configuration

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

image

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)

image

Right turn: Min($+5,100)

image

Installation

User Interface

Examples and tutorials

MSFS2020

X-Plane

Workshops

Community Boards & Devices

Additional Information

Firmware

Clone this wiki locally