Start a new topic

button help! callbacks?

Im trying to make buttons stay on when pushed and off when released.Heve is my code ,

(8.44 KB)


a button is a momentary component

 - it does remain on when pushed

 - it does go to released when released

This will be controlled first by the touch sensor

 - physical press - on.  physical release - off.

You present an .ino, so?

 - before I would be enticed into reading your code

   you need to provide more details

   - purpose, what are you trying to achieve, what have you tried already

At least try to make some effort of your own to make it easier for others to help

Are you experienced in coding?  

  - Makes a difference as to what direction to point you

Especially in coding, you must learn to describe

 I am tryintg to achive  multiple buttons on one page , Four of them I want  to go ON when press and OFF when pressed like in sketch .The other four , with  button  pressed , its ON and when  released its   OFF. I have researched and found  I  need  to detect change of button state and  write callbacks properly.                                                                                                                                                      Sample:                                                                                                                                          Nextion Touch Return Data is formatted 0x65 0x02 0x05 0x01 0xFF 0xFF 0xFF

         The first byte of 0x65 identifies this as a touch event, triple 0xFF termination

          from page 0x02 component 0x05 and touch 0x01

          (touch 0x01 pressed = push  and 0x00 released = pop)


            I m just not sure how to modify it yet ........thanks for your time 

So, I don't know your experience level, no matter, I will go with the basics.

A Button maybe the wrong choice from your description.

  A Button component is a Momentary component as described above.

When you like to have two states then a Dual-state button is required

  bt0.val=0 off  bt0.val=1

Always choose the right elements for the task at hand

  in electronics, or in coding - the right choice makes work easier.

I m sorry about that part  Im two weeks in  thank  you love this product making the  dreams come true

Login or Signup to post a comment