Sending data from Nextion to Arduino

Hey everyone,
In my nextion display I have some radio buttons and a dual state button.
I need my display to send a command when I turn on the dual state button which indicates which radio buttons are selected.
For example if the first and second radios are selected and then dual state button switched to 1 from 0, send the command "first operation" to my Arduino.
I know I can use "print" function in Nextion editor like this:

if (bt0.val==1)
{
if(radio1.val==1&&radio2.val==1)
{
print "first operation"
}
.
.
.
}

But how it is possible to read this command in Arduino?
How can I read the command and run a specific function?

Hello Niwo,
Welcome to the forum.

Please read 'how to use this forum - please read', especially #7 about posting code.

I suggest you work though the examples in 'using Nextion displays with Arduino' and adapt them to what you are trying to do.

If it were me I'd send all the changes of state of every button to the Arduino and use variables on the Arduino to keep track of what state each object is in, then use code on the Arduino to check for particular states. I wouldn't try to do it on the Nextion.

PerryBebbington:
Hello Niwo,
Welcome to the forum.

Please read 'how to use this forum - please read', especially #7 about posting code.

I suggest you work though the examples in 'using Nextion displays with Arduino' and adapt them to what you are trying to do.

If it were me I'd send all the changes of state of every button to the Arduino and use variables on the Arduino to keep track of what state each object is in, then use code on the Arduino to check for particular states. I wouldn't try to do it on the Nextion.

Thank you PerryBebbington.
I am sorry for my code, I modified it according to rules!
For some reasons I have to check states in my nextion display (because of complexity of my codes in Arduino), I think I find a solution for my problem but I need help.
I put a text box in my page and I set it to be invisible when I go to the page using "vis text,0" code.
then I programed my display to change the text according to the states of buttons.
Now my question is how to read that text in my arduino and decide what to do.
I searched around and I found a command in nextion library that is: "gettext"
I haven't tried it yet, but I hope it works.
However I would be happy to hear your opinion about this or any other solution.
Thanks

I am sorry for my code, I modified it according to rules!

Thank you!

I searched around and I found a command in nextion library that is: "gettext"

If you read my tutorial you will see I do not use or know about the Nextion libraries, so I can't help with that, sorry. There are others here who do know about them and if one of them is reading this maybe they will help. Note that the original libraries a full of bugs; there is a link from my tutorial to revised Nextion libraries created by Ray Livingstone.

My methods avoid the use of libraries but they do require you to understand what is going on in the code I created, rather than blindly using a library with functions without understanding them.