I want a dual state button on the HMI that is fully controlled by the microcontroller.
The microcontroller must be able to determine whether the button is active or not.
Which means that if the microcontroller makes the button active, then the user can toggle the button, as usual with the dual-state button.
But if the microcontroller makes the button inactive, the button is still displayed on the HMI, but when the user press it nothing should happen.
Now I do this by setting ‘bt0.val=0’ the button to OFF, but the button is not inactive with this.
When a user presses the button, the Nextion HMI will set itself ‘bt0.val’ to ‘1’.
The microcontroller must then quickly send ‘bt0.val=0’ again, to disable the button again, because this button should be inactive.
However, ‘pic2’ of the dual state button becomes visible for a moment, not very nice.
Can this be done differently?