NEXTION DISPLAY FOR FLOWCODE 9 ........PLEASE....

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
solozerouno
Posts: 113
http://meble-kuchenne.info.pl
Joined: Tue Dec 08, 2020 4:36 am
Has thanked: 2 times
Been thanked: 2 times

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

Post 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

solozerouno
Posts: 113
Joined: Tue Dec 08, 2020 4:36 am
Has thanked: 2 times
Been thanked: 2 times

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

Post 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.

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

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

Post 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.

solozerouno
Posts: 113
Joined: Tue Dec 08, 2020 4:36 am
Has thanked: 2 times
Been thanked: 2 times

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

Post 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

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

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

Post 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 179 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.

evolutiongtx
Posts: 6
Joined: Sat Dec 05, 2020 12:48 am

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

Post 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!

Post Reply