Start a new topic

Progress bar and Button

I'm using a rotary encoder via an interrupt to change the value of a progress bar plus a button to turn on an LED. Because my void loop is constantly checking for changes, many button presses are lost. If I change my code so that I only change the progress bar if the encoder changes value, the LED is OK but I miss many encoder changes. Any suggestions?

Rather than constantly polling for changes, use a Send Component ID, it a touch press/release event in your HMI.  On the touch of that component, the Nextion will send its code (as per the Nextion Instruction Set).  There are many discussions on the boards as to how to get your message or Rx/Tx, and then evaluate if message = from your component1 - then execute your actions to respond to the event.

Thanks Patrick, I'm new at this and will send through the HMI and code later today. I think the problem lies in the fact that I'm using j0.setValue(number); and this is being sent continuously in the loop stopping detection of the button press. I'm using release event for the button in my HMI.

Login or Signup to post a comment