Difference between revisions of "Component: Nextion Display (Graphical Color)"
From Flowcode Help
Jump to navigationJump to search(16 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | {| style="width:50%" | |
− | {| | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Author | + | | width="20%" style="color:gray;" | Author |
| Matrix TSL | | Matrix TSL | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Version | + | | width="20%" style="color:gray;" | Version |
− | | 1.0 | + | | 1.0 |
|- | |- | ||
− | | width="20%" style="color: gray;" | Category | + | | width="20%" style="color:gray;" | Category |
| Graphical Color | | Graphical Color | ||
|} | |} | ||
+ | ==Nextion Display component== | ||
+ | A simple libray to interface a Nextion display. The elements on the nextion display are built using the Nextion Editor software and uploaded to the display. The component can then interact with the display elements. | ||
− | == | + | ==Component Source Code== |
− | |||
− | |||
− | |||
− | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_API_Display_Nextion.fcfx FC_Comp_Source_API_Display_Nextion.fcfx] | |
− | = | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_API_Display_Nextion.fcfx FC_Comp_Source_API_Display_Nextion.fcfx] |
− | + | ==Detailed description== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ''No detailed description exists yet for this component'' | ||
− | === | + | ==Examples== |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ===Handling Buttons=== | |
− | + | This example looks for button presses with IDs 1 and 2. On a button release event the corresponding LEDs will be toggled. | |
+ | {{Fcfile|NextionTouchDemo.fcfx|Nextion Touch Demo}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ==Macro reference== | |
− | |||
− | :[[ | + | ===GetText=== |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetText''' | ||
+ | |- | ||
+ | | colspan="2" | Gets the text of a specific item | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | '''Return | + | ===GetTouchEvent=== |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTouchEvent''' | ||
+ | |- | ||
+ | | colspan="2" | Collects the next touch event in the queue. Returns 0 for no touch event detected, 1= touch press, 2 = touch release | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
+ | ===GetTouchID=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTouchID''' | ||
+ | |- | ||
+ | | colspan="2" | Gets the ID of the corresponding touch event. Must be called after calling GetTouchEvent component macro. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | ''' | + | ===GetValue=== |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetValue''' | ||
+ | |- | ||
+ | | colspan="2" | Gets the value from a specific item | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
+ | ===Initialise=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
+ | |- | ||
+ | | colspan="2" | Sets up the UART connection to the Nextion display | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | ===SetBackgroundColour=== |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetBackgroundColour''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the background colour of a specific item | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" | Colour | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | ===SetFontColour=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetFontColour''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the foreground font colour of a specific item | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" | Colour | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | '' | + | ===SetPage=== |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPage''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the page of the display allowing multiple configurations | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | Name of the page e.g. "page0" | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | == | + | ===SetText=== |
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetText''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the text of a specific item | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Text | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | + | ===SetValue=== | |
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetValue''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the numeric value of a specific item | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Name | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" | Number | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | + | ==Property reference== | |
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] | |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Communications | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Channel | |
− | + | |- | |
− | + | | colspan="2" | UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Baud Options | |
− | + | |- | |
− | Pin to be used for Transmit data | + | | colspan="2" | Baud rate option selector |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |
− | + | | width="90%" | Baud Rate | |
− | + | |- | |
− | + | | colspan="2" | | |
− | Pin to be used for Receive data | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | TX | |
− | + | |- | |
− | + | | colspan="2" | Pin to be used for Transmit data | |
− | + | |- | |
− | Number of touch press/release events we can store before running out of memory. | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] |
− | + | | width="90%" | RX | |
− | + | |- | |
− | + | | colspan="2" | Pin to be used for Receive data | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | Sets the number of byte elements inside the circular buffer. | + | | width="90%" | Touch Queue Size |
− | + | |- | |
− | + | | colspan="2" | Number of touch press/release events we can store before running out of memory. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | + | | width="90%" | Receive Buffer Size | |
− | Time in milliseconds to wait for a reply to a command. | + | |- |
− | + | | colspan="2" | Sets the number of byte elements inside the circular buffer. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | + | | width="90%" | Timeout | |
− | + | |- | |
− | Selects if the scope traces are automatically added to the data recorder window or not. | + | | colspan="2" | Time in milliseconds to wait for a reply to a command. |
− | + | |- | |
− | Simulation - draws an approximation of the UART data onto the scope trace. | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] |
− | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation | |
− | ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. | + | |- |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | |
− | + | | width="90%" | Scope Traces | |
− | + | |- | |
− | + | | colspan="2" | Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. | |
− | Selects if the console data is automatically generated or not | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | |
− | + | | width="90%" | Console Data | |
− | + | |- | |
− | + | | colspan="2" | Selects if the console data is automatically generated or not | |
− | + | |- | |
− | Simulation data source used to allow the component to connect to various remote devices | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] |
− | + | | width="90%" | Data Source | |
− | Nothing - Simulation data is ignored | + | |- |
− | + | | colspan="2" | Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data injector component on the Panel. | |
− | COM port - Routes the communication data to and from a physical or virtual COM port | + | |} |
− | |||
− |
Latest revision as of 13:08, 7 February 2023
Author | Matrix TSL |
Version | 1.0 |
Category | Graphical Color |
Contents
Nextion Display component
A simple libray to interface a Nextion display. The elements on the nextion display are built using the Nextion Editor software and uploaded to the display. The component can then interact with the display elements.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_API_Display_Nextion.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_API_Display_Nextion.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Handling Buttons
This example looks for button presses with IDs 1 and 2. On a button release event the corresponding LEDs will be toggled.
Macro reference
GetText
GetText | |
Gets the text of a specific item | |
- STRING | Name |
- STRING | Return |
GetTouchEvent
GetTouchEvent | |
Collects the next touch event in the queue. Returns 0 for no touch event detected, 1= touch press, 2 = touch release | |
- BYTE | Return |
GetTouchID
GetTouchID | |
Gets the ID of the corresponding touch event. Must be called after calling GetTouchEvent component macro. | |
- UINT | Return |
GetValue
GetValue | |
Gets the value from a specific item | |
- STRING | Name |
- ULONG | Return |
Initialise
Initialise | |
Sets up the UART connection to the Nextion display | |
- VOID | Return |
SetBackgroundColour
SetBackgroundColour | |
Sets the background colour of a specific item | |
- STRING | Name |
- ULONG | Colour |
- VOID | Return |
SetFontColour
SetFontColour | |
Sets the foreground font colour of a specific item | |
- STRING | Name |
- ULONG | Colour |
- VOID | Return |
SetPage
SetPage | |
Sets the page of the display allowing multiple configurations | |
- STRING | Name |
Name of the page e.g. "page0" | |
- VOID | Return |
SetText
SetText | |
Sets the text of a specific item | |
- STRING | Name |
- STRING | Text |
- VOID | Return |
SetValue
SetValue | |
Sets the numeric value of a specific item | |
- STRING | Name |
- ULONG | Number |
- VOID | Return |