Unofficial Nextion/TJC User Forum

change state and image of dual button

Hello friends I need help for this function.
my project is to control a light with a nextion screen and an external button and when I activate the external button I need the Dual button to change state and change to the second image.
I use this command.
bt0.Set_state0_image_pic0(0);
the screen receives this bt0.pic0=0ÿÿÿ but it doesn’t change the image, it doesn’t activate the button.
Any help thanks.

It’s easy to send data directly to the Nextion without using a library.
This works for me:

Serial.print(“pageMain.bt10.val=1”); // 0 = enabled
Serial.print("\xFF\xFF\xFF");

All of the image changes in my code are done on the Nextion.

p.s. Change Serial to the actual port you have the Nextion connected to.

Thanks for answering.
this is the address of my dual button
NexDSButton bBarlovento = NexDSButton(1,18, "bBarlovento ");

nextion button

Serial2.print(“page1.bBarlovento.val=1”); // 2 = enabled
Serial2.print("\xFF\xFF\xFF");

thanks for your help elf, it will be like this the command I use arduino mega 2560 in serial 2

thank you very much elf it worked for me…

Is there any document where to know all the commands by serial?

I think most of the commands listed in the Instruction Set: Instruction Set - Nextion should work. The attributes in green in the IDE should all be settable over serial. You can always put code in a Nextion control (hotspot uses the least amount of memory) then call it using the click command over serial.

elf I have my nextion screen set so that the brightness goes to 0 after 15 seconds.
could you tell me how is the command to raise brightness from arduino? Thank you

dim=(brightness) setting from 0 to 100
or dims=(brightness) for a more durable setting which survives reboot

Thank you very much Fjodor I got it


This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).