Page 2 of 2

Re: NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Posted: Fri Jul 09, 2021 5:40 pm
by solozerouno
Ok excuse me... I recently watched a video on youtube and saw that if a button is created to arduino three parameters are sent:
object b0 ,
id 1
page 0

now if i get this data from the display in FLC9 can i use it ?
with your touh manager have you calculated the three data that arrive and then if I want to send to a text window on nextion from arduino or FLC9 from program how do I do?
thanks a lot
solozerouno

Re: NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Posted: Tue Jul 13, 2021 1:23 pm
by solozerouno
Can you please explain me how to use the nextion component specifically to manage a touch from a button programmed with the nextion editor and downloaded to the display ? I mean if I press on the nextion display a programmed button, which data I get on the uart to my Arduino?
The code sent by nextion to the uart when you press the first button is in HEX:
65 00 01 00 FF FF FF
the second button is in HEX :
65 00 02 00 FF FF FF FF
How do I interpret this data in the touch of button one or two ?
Thanks solozerouno.

Re: NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Posted: Tue Jul 13, 2021 4:10 pm
by BenR
Hello,

To interact with touchable items you simply call the GetTouchEvent function, this returns 0 for no touch detected, 1 for touch down detected or 2 for touch release detected.

If the function returns 1 or 2 then call the GetTouchID function to get the ID number of the item. The 16-bit ID contains the page in the top 8-bits and the item number in the bottom 8-bits.

ID = GetTouchID
Page = ID >> 8
Item = ID & 255

The Touch Queue Size property sets how many touch events can be stored at any one time.

Hope this helps.

Re: NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Posted: Tue Jul 13, 2021 10:02 pm
by solozerouno
Sorry then I have to get the HEX number:
65 00 01 00 FF FF
and I have to consider it with the PAGE as you wrote me and
as ITEM the id of the component including the page or after I extracted the page ?
Sorry, but with programming I make a bit of a mess.
Thanks.
solozerouno

Re: NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Posted: Wed Jul 14, 2021 10:01 am
by BenR
Hello,

Here's an example to help get you started. Each button will toggle an output pin on the microcontroller when released.
NextionTouchDemo.fcfx
(14.9 KiB) Downloaded 181 times

I've also just pushed a fix for the component too as buttons seem to only output a 0 event on release and so I've cought this and converted to a 2 touch release event so it works like all of the other touch enabled items.

Re: NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Posted: Sat Nov 20, 2021 4:32 pm
by evolutiongtx
Hi Ben,

The nextion component is working well.

I do have one small request however.

For the set_text macro, is it possible to add a macro that allows one to "add" text instead of overwriting the existing text.

Example:

text.txt="some text"

text.txt+="some text"

the bottom example will add text to a element instead of overwriting the text. I hope this makes sense, thank you very much for your efforts!