Hello 
I use this instruction in a VB Timer to read the "Pitot" value in the Cessna 172:
I use these instructions to enable or disable the "Pitot" button:
"Me.btnPitot" is a button on a VB Form.
Clicking the button in MSFS2020, changes the button's value in the Form.
(Changing the button value in the Form does not trigger an event in MSFS2020)
Clicking the button in the Form changes the button's value in MSFS2020.
Everything works. But there's a problem.
If I activate the Pitot with the button in the Form, MSFS2020 also activates its button.
But if I immediately use the button in MSFS2020 to disable the Pitot, my button on the Form remains activated.
Because in "OnRecvSimobjectDataBytype", "data" is always equal to 1.
And yet, I observe that the Pitot probe is indeed deactivated because the value of the "AMP" indicator changes.
I enable and disable the Pitot button in MSFS2020 several times, but "data" always returns 1.
I tried using the "PITOT HEAT SWITCH:index" event, but it's the same.
I don't understand.
If I do the opposite, if I first activate the Pitot with the MSFS2020 button and then deactivate the Pitot with
the button in the Form, it works.
I use this instruction in a VB Timer to read the "Pitot" value in the Cessna 172:
Code:
.AddToDataDefinition(EnumDefinitions.Struct1, "PITOT HEAT", "bool", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.INT32, 0, 0)
and
.RequestDataOnSimObjectType(DataRequests.Request_1, EnumDefinitions.Struct1, 0, SIMCONNECT_SIMOBJECT_TYPE.USER)
I use these instructions to enable or disable the "Pitot" button:
Code:
num EnumEventsID
PITOT_HEAT_OFF = 0
PITOT_HEAT_ON = 1
End Enum
.MapClientEventToSimEvent(EnumEventsID.PITOT_HEAT_OFF, "PITOT_HEAT_OFF")
.AddClientEventToNotificationGroup(Group_ID.Group0, EnumEventsID.PITOT_HEAT_OFF, False)
.MapClientEventToSimEvent(EnumEventsID.PITOT_HEAT_ON, "PITOT_HEAT_ON")
.AddClientEventToNotificationGroup(Group_ID.Group0, EnumEventsID.PITOT_HEAT_ON, False)
.SetNotificationGroupPriority(Group_ID.Group0, SimConnect.SIMCONNECT_GROUP_PRIORITY_STANDARD)
and
If Me.btnPitot.Valeur = True Then
.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EnumEventsID.PITOT_HEAT_ON, 0, Group_ID.Group0, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)
Else
.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, EnumEventsID.PITOT_HEAT_OFF, 0, Group_ID.Group0, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)
End If
"Me.btnPitot" is a button on a VB Form.
Clicking the button in MSFS2020, changes the button's value in the Form.
(Changing the button value in the Form does not trigger an event in MSFS2020)
Clicking the button in the Form changes the button's value in MSFS2020.
Everything works. But there's a problem.
If I activate the Pitot with the button in the Form, MSFS2020 also activates its button.
But if I immediately use the button in MSFS2020 to disable the Pitot, my button on the Form remains activated.
Because in "OnRecvSimobjectDataBytype", "data" is always equal to 1.
And yet, I observe that the Pitot probe is indeed deactivated because the value of the "AMP" indicator changes.
I enable and disable the Pitot button in MSFS2020 several times, but "data" always returns 1.
I tried using the "PITOT HEAT SWITCH:index" event, but it's the same.
I don't understand.
If I do the opposite, if I first activate the Pitot with the MSFS2020 button and then deactivate the Pitot with
the button in the Form, it works.

