Start a new topic

If button is in one state, do not allow selection of others.

I have 2 Dual-state buttons. I want only one selectable at a time. Meaning, if I press one the other can NOT be activated. Is this possible? Thank you


it is indeed possible.

Ok, great! Any tips? I am currently using the enhanced disply. Thank you


   Take the time to exercise care with the logic for this.

   Logic to disable the other needs to be in the one pressed

   Logic to re-enable the other when the one is released

   Take care not to disable both or not effectively prevent

Your code will execute the same for this on the enhanced

  as it does on the basic models - no code differences at all.

The enhanced models have more sram and storage, and RTC, GPIO and EEPROM

  such dual-state logic will use not require and of the enhanced enhancements to do.

I am relatively new at programming, so how would the logic look here? If... then.... Thank you again

When new to programming you need to test ideas - small ideas

 - it is through observing what happens when you try "tada" that you build

   your knowledge and it is later that because you know now what tada does

   that you recognize when tada is used in something else.  You also learn

   what not to do.

Logic looks something like:

   each dual-state button release

      evaluate .val of this button

      if .val is 0 then button is off then

        remove prevention against other button

      but if not 0 then .val would be 1 then

        enable prevention against other button

Now you must look through the Nextion Instruction Set and your MCU coding language

to find the commands and instructions that will help you build it.

This worked.



tsw bt2,0




tsw bt2,1


Thank you!

now on to the next..

My goal is to have a single 4-axis stepper arm with 2 programs selectable on the display. Ideally when the second program is selected while the first program is running, the arm should go to the home position before allowing the playing of the second program.

Login or Signup to post a comment