Hello Pascal,
great, if it works.
Why the programmer of PMDG in this case has just taken these parameters, I do not know. But: Basically, certain parameters are always used the same way in the PMDG.
Wherever something is rotated, such as an encoder, the parameters for Mousewheel are used up / down.
The rotary switches always use the parameters 0, 1, 2, 3 ....
For simple switches, you have to try whether 0 or 1 or left / right mouse click.
As far as I know, the light switches are always 0, 1 or 2.
With the parameters one must get rid of the fact that a 0 turns off something, a 1 or two switches something on. OFF could also be the 2 from the pure logic. Here the programmer pursues his own logic, which however, when "built" by a studied programmer, follows the learned logic, which is always logical. Logically, right?
So it's up to the programmer who fixes these things.
To your switch, why you need two pins of the MEGA and the parameters:
The numbers have the advantage that we understand them logically easier. The parameters could also be called peanuts, bananas or oranges. Here we have, however, which promotes better understanding, only 0, 1 and 2.
The switch is wired as follows: 3 connections, the lower one stands for the OFF position and comes to the 1st pin of the MEGA, the middle connection is connected to GND and the upper goes to the 2nd pin of the MEGA.
The connections are reversed at the top and bottom because the connections are closed by the lever opposite.
To proceed: Assuming that the shift lever is in the upper position, so GND is switched from the middle port to the lower port and thus to Pin1 of the MEGA. This tells Mobiflight to send parameter 0 to the simulator. The parameter 0 is thus the Zusatnd lights retracted and OFF assigned.
However, if the gear lever is now in the middle, Mobiflight does not recognize this position, but only recognizes that GND Pin1 is no longer in contact. This corresponds to the ON RELEASE state. This, in turn, causes MobiFlight to send a 1 (because it puts it that way) to the simulation. As a result, the lamp is extended, but still remains off.
If the lever is now folded down, GND is now placed on the upper terminal of the switch and thus on pin2 of the MEGA. Mobiflight detects this and sends the parameter 2 to the simulation (always connected to the corresponding EventID), which turns on the light.
What follows is again the switch in middle position. As a result, Mobiflight detects that GND is no longer present at pin2, which now means for this pin ON RELEASE, whereupon parameter 1 is again sent to the simulation. The light is then turned off, but the headlight remains extended. The rest is repeated.
If you have not realized things in English, you can simply copy this text and copy it to the Google translator and have it translated to French there.
I've tried to explain the context to you in simple terms and hope it's understandable for you.
If you have further questions, do not be afraid to ask them here in the forum. Every user has his or her area of expertise here and will be happy to help you as best he can. It will not take long, then you can help other users