README.html 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>READMEV1</title>
  7. <link rel="stylesheet" href="https://stackedit.io/style.css" />
  8. </head>
  9. <body class="stackedit">
  10. <div class="stackedit__html"><h1 id="easy-nextion-library">Easy Nextion Library</h1>
  11. <h2 id="description">Description</h2>
  12. <p>A simple library that uses only four functions. You can easily benefit from Nextion’s wide range of features and advantages in just a few easy steps.<br>
  13. The library uses a custom protocol that can prove to be a <strong>powerful tool</strong> for advanced users as it can be <strong>easily modified</strong> to meet one’s needs.<br>
  14. This is an attempt to give a very simple method to use Nextion monitors for beginners at programming and at the same time to be a strong and reliable method that can be capable of satisfying the needs of the advance programming.<br>
  15. The handling of Nextion should be as simple and at the same time as professional as a display of this kind deserves.</p>
  16. <p>I have invested time and resources providing open source codes, like this one. Please do not hesitate to support my work!<br>
  17. If you found this work useful and has saved you time and effort,<br>
  18. just simply paypal me at this Link: <a href="https://paypal.me/seithan">seithagta@gmail.com</a></p>
  19. <p>You can find more examples, tutorials and projects with Nextion on my website <a href="https://seithan.com/">seithan.com</a> or at my YouTube channel <a href="https://www.youtube.com/channel/UCk_AjYtvzUC58ups5Lm053g">Thanasis Seitanis</a></p>
  20. <h2 id="installation">Installation</h2>
  21. <h3 id="first-method">First Method</h3>
  22. <ol>
  23. <li>In the Arduino IDE, navigate to Sketch &gt; Include Library &gt; Manage Libraries</li>
  24. <li>Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.</li>
  25. <li>Then search for EasyNextionLibrary using the search bar.</li>
  26. <li>Click on the text area and then select the latest version and install it.</li>
  27. </ol>
  28. <p><img src="../media/EasyNextionLibrary_Arduino_Library_Manager.png" alt="enter image description here"></p>
  29. <h3 id="second-method">Second Method</h3>
  30. <ol>
  31. <li>Download the latest release of EasyNextionLibrary.</li>
  32. </ol>
  33. <ul>
  34. <li>From: <a href="https://github.com/Seithan/EasyNextionLibrary">https://github.com/Seithan/EasyNextionLibrary</a></li>
  35. </ul>
  36. <ol start="2">
  37. <li>Extract the <code>.zip</code> file</li>
  38. <li>Copy the EasyNextionLibrary folder, to: …\Arduino\libraries\</li>
  39. </ol>
  40. <p><em><strong>NOTE</strong></em>: <code>.HMI</code> files for Nextion Editor are also included in every example’s folder.<br>
  41. All <code>.HMIs</code> are set for 2.8" Basic screens, so as to be easier to modify it for bigger screens.</p>
  42. <h2 id="the-main-functions">The main functions</h2>
  43. <ul>
  44. <li><code>begin();</code></li>
  45. <li><code>writeNum();</code></li>
  46. <li><code>writeStr();</code></li>
  47. <li><code>readNumber();</code></li>
  48. <li><code>trigger();</code></li>
  49. <li><code>readStr();</code> Added with version 1.0.4</li>
  50. </ul>
  51. <p><em><strong>And the public variables:</strong></em></p>
  52. <ul>
  53. <li>currentPageId (Data Type: <strong>Integer</strong>)</li>
  54. <li>lastCurrentPageId (Data Type: <strong>Integer</strong>)</li>
  55. </ul>
  56. <p><strong>Functions for user custom command protocol</strong></p>
  57. <ul>
  58. <li><code>readByte();</code> Added with version 1.0.5</li>
  59. <li><code>easyNexReadCustomCommand()</code> Added with version 1.0.5<br>
  60. and the public variables for user custom command protocol Added with version 1.0.5</li>
  61. <li><code>cmdGroup</code> (Data Type: <strong>Byte</strong>)</li>
  62. <li><code>cmdLength</code> (Data Type: <strong>Byte</strong>)</li>
  63. </ul>
  64. <h3 id="details-examples-and-explanation-on-custom-protocol-can-be-found-on-my-website-at">Details, examples and explanation on custom protocol, can be found on my website at:</h3>
  65. <h4 id="httpsseithan.comeasy-nextion-librarycustom-protocol"><a href="https://seithan.com/Easy-Nextion-Library/Custom-Protocol/">https://seithan.com/Easy-Nextion-Library/Custom-Protocol/</a></h4>
  66. <h2 id="step-example">4-step Example</h2>
  67. <ol>
  68. <li><strong>Include</strong> <em><strong>EasyNextionLibrary</strong></em> and create an object of <code>EasyNex</code> class</li>
  69. </ol>
  70. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token macro property">#<span class="token directive keyword">include</span> <span class="token string">"EasyNextionLibrary.h"</span> </span><span class="token comment">// Include EasyNextionLibrary</span>
  71. EasyNex <span class="token function">myNex</span><span class="token punctuation">(</span>Serial<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Create an object of EasyNex class with the name &lt; myNex &gt; </span>
  72. <span class="token comment">// Set as parameter the Hardware Serial you are going to use</span>
  73. </code></pre>
  74. <ol start="2">
  75. <li><strong>Begin the object</strong> and give the desired baud rate as a parameter. Also, initialize the built-in LED as output</li>
  76. </ol>
  77. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">void</span> <span class="token function">setup</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  78. myNex<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token number">9600</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Begin the object with a baud rate of 9600</span>
  79. <span class="token comment">// If no parameter was given in the begin(), the default baud rate of 9600 will be used </span>
  80. <span class="token function">pinMode</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">,</span> OUTPUT<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// The built-in LED is initialized as an output </span>
  81. <span class="token punctuation">}</span>
  82. </code></pre>
  83. <ol start="3">
  84. <li><strong>Place</strong> the <strong>NextionListen()</strong> function in the loop.</li>
  85. </ol>
  86. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">void</span> <span class="token function">loop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  87. myNex<span class="token punctuation">.</span><span class="token function">NextionListen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// This function must be called repeatedly to response touch events</span>
  88. <span class="token comment">// from Nextion touch panel. Actually, you should place it in your loop function.</span>
  89. <span class="token punctuation">}</span>
  90. </code></pre>
  91. <ol start="4">
  92. <li><strong>Select one of the 50 predefined trigger()</strong> functions and use it as a simple void function (nothing returned).<br>
  93. Declare the void function by simply writing:</li>
  94. </ol>
  95. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">void</span> <span class="token function">trigger0</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  96. <span class="token punctuation">[</span> put your code here <span class="token operator">!</span><span class="token operator">!</span><span class="token operator">!</span><span class="token operator">!</span><span class="token punctuation">]</span>
  97. <span class="token punctuation">}</span>
  98. </code></pre>
  99. <ul>
  100. <li>Write the code you want to run in there.<br>
  101. The <code>trigger0()</code> function will run every time the following sequence of bytes (in HEX format) <code>23 02 54 00</code> comes to Arduino’s Serial. To do that, write in the <code>Touch Release Event</code> of the button b0, this command: <code>printh 23 02 54 00</code></li>
  102. </ul>
  103. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">void</span> <span class="token function">trigger0</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  104. <span class="token function">digitalWrite</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">,</span> <span class="token operator">!</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  105. <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span> <span class="token operator">==</span> HIGH<span class="token punctuation">)</span><span class="token punctuation">{</span>
  106. myNex<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"b0.bco"</span><span class="token punctuation">,</span> <span class="token number">2016</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 background color to GREEN (color code: 2016)</span>
  107. myNex<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"b0.txt"</span><span class="token punctuation">,</span> <span class="token string">"ON"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 text to "ON"</span>
  108. <span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span> <span class="token operator">==</span> LOW<span class="token punctuation">)</span><span class="token punctuation">{</span>
  109. myNex<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"b0.bco"</span><span class="token punctuation">,</span> <span class="token number">63488</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 background color to RED (color code: 63488)</span>
  110. myNex<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"b0.txt"</span><span class="token punctuation">,</span> <span class="token string">"OFF"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 text to "ON"</span>
  111. <span class="token punctuation">}</span>
  112. <span class="token punctuation">}</span>
  113. </code></pre>
  114. <p>Enjoy the Easy Nextion Library!! Please do not forget the LED on :)</p>
  115. <h2 id="full-example-code">Full Example Code</h2>
  116. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token comment">/*
  117. * FourStepExample.ino - Simple example code
  118. * Copyright (c) 2020 Athanasios Seitanis &lt; seithagta@gmail.com &gt;.
  119. * All rights reserved. EasyNextionLibrary is licensed under the MIT License
  120. * https://opensource.org/licenses/MIT
  121. */</span>
  122. <span class="token macro property">#<span class="token directive keyword">include</span> <span class="token string">"EasyNextionLibrary.h"</span> </span><span class="token comment">// Include EasyNextionLibrary</span>
  123. EasyNex <span class="token function">myNex</span><span class="token punctuation">(</span>Serial<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Create an object of EasyNex class with the name &lt; myNex &gt; </span>
  124. <span class="token comment">// Set as parameter the Hardware Serial you are going to use</span>
  125. <span class="token keyword">void</span> <span class="token function">setup</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  126. myNex<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token number">9600</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Begin the object with a baud rate of 9600</span>
  127. <span class="token comment">// If no parameter was given in the begin(), the default baud rate of 9600 will be used </span>
  128. <span class="token function">pinMode</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">,</span> OUTPUT<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// The built-in LED is initialized as an output </span>
  129. <span class="token punctuation">}</span>
  130. <span class="token keyword">void</span> <span class="token function">loop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  131. myNex<span class="token punctuation">.</span><span class="token function">NextionListen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// This function must be called repeatedly to response touch events</span>
  132. <span class="token comment">// from Nextion touch panel. Actually, you should place it in your loop function.</span>
  133. <span class="token punctuation">}</span>
  134. <span class="token keyword">void</span> <span class="token function">trigger0</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  135. <span class="token comment">/* Create a button on Nextion
  136. * Write in the Touch Release Event of the button
  137. * this command: printh 23 02 54 00
  138. * Every time the button is pressed, the trigger0() function will run
  139. * and the code inside will be executed once
  140. */</span>
  141. <span class="token function">digitalWrite</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">,</span> <span class="token operator">!</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//If LED_BUILTIN is ON, turn it OFF, or the opposite</span>
  142. <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span> <span class="token operator">==</span> HIGH<span class="token punctuation">)</span><span class="token punctuation">{</span>
  143. myNex<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"b0.bco"</span><span class="token punctuation">,</span> <span class="token number">2016</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 background color to GREEN (color code: 2016)</span>
  144. myNex<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"b0.txt"</span><span class="token punctuation">,</span> <span class="token string">"ON"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 text to "ON"</span>
  145. <span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span> <span class="token operator">==</span> LOW<span class="token punctuation">)</span><span class="token punctuation">{</span>
  146. myNex<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"b0.bco"</span><span class="token punctuation">,</span> <span class="token number">63488</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 background color to RED (color code: 63488)</span>
  147. myNex<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"b0.txt"</span><span class="token punctuation">,</span> <span class="token string">"OFF"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set button b0 text to "ON"</span>
  148. <span class="token punctuation">}</span>
  149. <span class="token punctuation">}</span>
  150. </code></pre>
  151. <h2 id="function-documentation">Function documentation</h2>
  152. <p><em><strong>The various combinations of attribute choices provide a wide range of expected behaviors with many combinations.<br>
  153. This combined with the Nextion Instruction Set creates the opportunity for very powerful HMIs.</strong></em></p>
  154. <p><em><strong>NOTE</strong></em>:<br>
  155. As these commands are using the Serial port to read and write, it is more preferred not to run them in the loop() without delay(); or some other method of not running them with the frequency of the loop and use them only when it is needed.<br>
  156. Using them in a loop, a delay in the loop can be noticed, especially when reading from the Serial. A Serial buffer overflow can also be caused.<br>
  157. <em><strong>Also NOTE</strong></em>: (from the Nextion Editor Guide)</p>
  158. <blockquote>
  159. <p>In an HMI project a page is a localized unit. When changing pages, the existing page is removed from memory and the &gt; &gt; requested page is then loaded into memory. As such components with a variable scope of <em><strong>local</strong></em> are only accessible while the page they are in is currently loaded. Components within a page that have a variable scope of <em><strong>global</strong></em> are accessible by prefixing the page name to the global component .objname.<br>
  160. As an Example:<br>
  161. A global Number component n0 on page1 is accessed by <strong>page1.n0</strong> .<br>
  162. A local Number component n0 on page1 can be accessed by page1.n0 or n0, but there is little sense to try access a local component if the page is not loaded. Only the component attributes of a global component are kept in memory. Event code is never global in nature.</p>
  163. </blockquote>
  164. <h3 id="function-trigger">Function trigger();</h3>
  165. <p><strong><code>Associated Library's Code Example:</code></strong> <strong><em><code>Trigger</code></em> <strong><code>and</code></strong> <em><code>FourStepExample</code></em></strong></p>
  166. <p><em><strong>Description:</strong></em><br>
  167. This is the most important function of the library.<br>
  168. And this is because, it gives you the ability to use the predefined functions and run your code from there.<br>
  169. These predefined functions are named <code>trigger0()</code>, <code>trigger1()</code>, <code>trigger2()</code>… up to <code>trigger50()</code>.<br>
  170. You can use them as a simple void function out of the loop, in which you will have written a block of code to run every time it is called.<br>
  171. You can call those <code>trigger()</code> functions and run the code they contain anytime by simply writing in a Nextion Event the command: <code>printh 23 02 54 XX</code> , where <code>XX</code> the id for the triggerXX() in HEX.<br>
  172. For example in a button’s Touch Release Event, write:</p>
  173. <table>
  174. <thead>
  175. <tr>
  176. <th>Command</th>
  177. <th>Function</th>
  178. </tr>
  179. </thead>
  180. <tbody>
  181. <tr>
  182. <td>printh 23 02 54 00</td>
  183. <td>trigger0()</td>
  184. </tr>
  185. <tr>
  186. <td>printh 23 02 54 01</td>
  187. <td>trigger1()</td>
  188. </tr>
  189. <tr>
  190. <td>…</td>
  191. <td>…</td>
  192. </tr>
  193. <tr>
  194. <td>printh 23 02 54 0A</td>
  195. <td>trigger10()</td>
  196. </tr>
  197. <tr>
  198. <td>… up to</td>
  199. <td>… up to</td>
  200. </tr>
  201. <tr>
  202. <td>printh 23 02 54 32</td>
  203. <td>trigger50()</td>
  204. </tr>
  205. </tbody>
  206. </table><p>In Arduino code, declare a void <code>trigger()</code> function with the predefined name you want to use and put your code there.<br>
  207. Declare the void function by simply writing:</p>
  208. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">void</span> <span class="token function">trigger0</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  209. <span class="token punctuation">[</span> put your code here <span class="token operator">!</span><span class="token operator">!</span><span class="token operator">!</span><span class="token operator">!</span><span class="token punctuation">]</span>
  210. <span class="token punctuation">}</span>
  211. </code></pre>
  212. <p>Example:</p>
  213. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token macro property">#<span class="token directive keyword">include</span> <span class="token string">"EasyNextionLibrary.h"</span></span>
  214. EasyNex <span class="token function">myObject</span><span class="token punctuation">(</span>Serial<span class="token punctuation">)</span><span class="token punctuation">;</span>
  215. <span class="token keyword">void</span> <span class="token function">setup</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  216. myObject<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token number">9600</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  217. <span class="token function">pinMode</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">,</span> OUTPUT<span class="token punctuation">)</span><span class="token punctuation">;</span>
  218. <span class="token punctuation">}</span>
  219. <span class="token keyword">void</span> <span class="token function">loop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  220. myObject<span class="token punctuation">.</span><span class="token function">NextionListen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  221. <span class="token punctuation">}</span>
  222. <span class="token keyword">void</span> <span class="token function">trigger0</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  223. <span class="token function">digitalWrite</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">,</span> <span class="token operator">!</span><span class="token function">digitalRead</span><span class="token punctuation">(</span>LED_BUILTIN<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  224. <span class="token punctuation">}</span>
  225. </code></pre>
  226. <p><em><strong>1st NOTE</strong></em>: To change the predefined names of the <code>trigger()</code> functions, there are details inside the <code>trigger.cpp</code> file and you can add up to <strong>255</strong> functions of this kind.<br>
  227. <em><strong>2nd NOTE</strong></em>: You can send the same <code>printh</code> command, to call the same function, from more than one component from any page, depending on your needs</p>
  228. <p><em>See Appendix at the end of the document for numbers in HEX table</em></p>
  229. <h3 id="function-begin">Function begin();</h3>
  230. <p><em><strong>Parameters:</strong></em><br>
  231. begin(<code>unsigned long</code>)<br>
  232. <strong>unsigned long</strong>: unsigned long baud = <strong>9600</strong> (default) if nothing is written in the begin() function</p>
  233. <p><em><strong>Description:</strong></em><br>
  234. <strong>The begin()</strong> method of the class in which we pass the initialization data to the objects.</p>
  235. <p><em><strong>Syntax:</strong></em></p>
  236. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token number">115200</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// for baud rate 115200</span>
  237. </code></pre>
  238. <h3 id="function-writenum">Function writeNum();</h3>
  239. <p><strong><code>Associated Library's Code Example:</code> <em><code>ReadAndWriteNumber</code></em></strong></p>
  240. <p><em><strong>Parameters:</strong></em><br>
  241. writeNum(<code>String</code>, <code>uint32_t</code>)</p>
  242. <ul>
  243. <li><strong>String</strong> = objectname.numericAttribute (example: “n0.val” or “n0.bco”…etc)</li>
  244. <li><strong>uint32_t</strong> = value (example: 84)(number from 0 to 4,294,967,295)</li>
  245. </ul>
  246. <p><em><strong>Description:</strong></em><br>
  247. For writing numbers in numeric attributes in components of any kind (variables, textboxes, etc.).</p>
  248. <ul>
  249. <li>We can change the shown value of a number box</li>
  250. <li>We can change the value of a numeric attribute of the design editing commands. Those commands are used to change the attribute of the components (button, text box, timer, numeric etc.) while Nextion is running.</li>
  251. </ul>
  252. <table>
  253. <thead>
  254. <tr>
  255. <th>Command</th>
  256. <th>Result on n0 comp.</th>
  257. <th>Syntax</th>
  258. </tr>
  259. </thead>
  260. <tbody>
  261. <tr>
  262. <td>n0.val=30</td>
  263. <td>Sets n0 component’s shown value to 30</td>
  264. <td><code>myObject.writeNum("n0.val", 30);</code></td>
  265. </tr>
  266. <tr>
  267. <td>va0.val=30</td>
  268. <td>Sets va0 variable’s value to 30</td>
  269. <td><code>myObject.writeNum("va0.val", 30);</code></td>
  270. </tr>
  271. <tr>
  272. <td>n0.bco=63488</td>
  273. <td>Sets background color to red</td>
  274. <td><code>myObject.writeNum("n0.bco", 63488);</code></td>
  275. </tr>
  276. <tr>
  277. <td>n0.font=0</td>
  278. <td>Sets font to font style with Id = 0</td>
  279. <td><code>myObject.writeNum("n0.font", 0);</code></td>
  280. </tr>
  281. <tr>
  282. <td>n0.pco=1055</td>
  283. <td>Sets font color to blue</td>
  284. <td><code>myObject.writeNum("n0.pco", 1055);</code></td>
  285. </tr>
  286. <tr>
  287. <td>n0.format=0</td>
  288. <td>Sets value format to decimal</td>
  289. <td><code>myObject.writeNum("n0.format", 0);</code></td>
  290. </tr>
  291. </tbody>
  292. </table><p>With the same way you can change the xcen, ycen, length and isbr</p>
  293. <p><em><strong>TIP:</strong> In a timer component, at the attribute &lt; <strong>en</strong> &gt;, you can start or stop the timer by writing <strong>0</strong> or <strong>1</strong>.</em><br>
  294. Also, at the attribute &lt; <strong>tim</strong> &gt;, you can set the time the timer is going to repeat the commands written in timer’s User-code event.</p>
  295. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"tm0.en"</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 0 = stop, 1 = start</span>
  296. myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"tm0.tim"</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// repeat code every 1000ms</span>
  297. </code></pre>
  298. <p><em><strong>Syntax:</strong></em></p>
  299. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"n0.val"</span><span class="token punctuation">,</span> <span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set the value of numeric n0 to 30</span>
  300. myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"n0.bco"</span><span class="token punctuation">,</span> <span class="token number">63488</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set background color of n0 to 63488(red)</span>
  301. myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"n0.font"</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set font to font style with ID 0</span>
  302. myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"n0.pco"</span><span class="token punctuation">,</span> <span class="token number">1055</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set font color to blue</span>
  303. myObject<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"n0.format"</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set value format to decimal</span>
  304. </code></pre>
  305. <p><em><strong>NOTE:</strong> Only attributes shown in green in the Editor can be both read and changed by user code at runtime.</em><br>
  306. <img src="../media/AttributePane.png" alt="Attribute panel"></p>
  307. <h3 id="send-floating-point-numbers-a-number-that-has-a-decimal-point.">Send floating-point numbers, a number that has a decimal point.</h3>
  308. <h3 id="or-send-a-number-on-a-textbox">Or send a number on a textbox</h3>
  309. <p><em><strong>Description:</strong></em><br>
  310. Nextion <strong>DOES NOT SUPPORT</strong> float numbers. Instead, it uses integer math and does not have real or floating support.<br>
  311. The Xfloat component is used for signed 32-bit integer values.<br>
  312. The <code>.vvs0</code> sets the number of digits shown to the left of the decimal (useful for leading zeros).<br>
  313. The <code>.vvs1</code> sets the number of digits shown to the right of the decimal.</p>
  314. <p><em><strong>You can send Floating-point numbers with these two ways</strong></em>:</p>
  315. <ul>
  316. <li>On a <strong>Xfloat component</strong> after you convert the float to int and multiply it by 10, the Xfloat component will put a comma <code>,</code> (decimal point) automatically after the last digit if attribute <code>vvs1</code> is set to 1.</li>
  317. </ul>
  318. <p><em><strong>Example:</strong></em></p>
  319. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">int</span> tempInt <span class="token operator">=</span> temperature<span class="token operator">*</span><span class="token number">10</span><span class="token punctuation">;</span> <span class="token comment">// Convert the float to int. Multiply it x10 </span>
  320. myNex<span class="token punctuation">.</span><span class="token function">writeNum</span><span class="token punctuation">(</span><span class="token string">"x0.val"</span><span class="token punctuation">,</span> tempInt<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Write it to x0 Xfloat component on Nextion</span>
  321. </code></pre>
  322. <p>it is obvious that if you want 2 decimal places, you will set the attribute <code>vvs1</code> to <code>2</code> and you will multiply by <code>100</code></p>
  323. <ul>
  324. <li>On a <strong>Textbox component</strong> after you convert the float value to String</li>
  325. </ul>
  326. <p><em><strong>Example:</strong></em></p>
  327. <pre class=" language-cpp"><code class="prism language-cpp">String tempString <span class="token operator">=</span> <span class="token function">String</span><span class="token punctuation">(</span>temperature<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Convert the float value to String, with 1 decimal place</span>
  328. myNex<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">,</span> tempString<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Write the String value to t0 Textbox component</span>
  329. </code></pre>
  330. <h3 id="function-writestr">Function writeStr();</h3>
  331. <p><strong><code>Associated Library's Code Example:</code> <em><code>WriteTextAndCommands</code></em></strong></p>
  332. <p><em><strong>Parameters:</strong></em></p>
  333. <ul>
  334. <li>
  335. <p>writeStr(<code>String</code>, <code>String</code>). <em>To change the <code>.txt</code> attribute in components</em><br>
  336. <strong>String No1</strong>: objectname.textAttribute (example: “t0.txt” or “b0.txt”)<br>
  337. <strong>String No2</strong>: value (example: “Hello World”)</p>
  338. </li>
  339. <li>
  340. <p>writeStr(<code>String</code>). <em>To send Designing and System Commands</em><br>
  341. <strong>String</strong>: The command to send on Nextion</p>
  342. </li>
  343. </ul>
  344. <p><em><strong>Description:</strong></em><br>
  345. For writing text in Nextion. The two ways the command can be used:</p>
  346. <p><strong>First Usage of the command</strong>:<br>
  347. Use <strong>writeStr(</strong> <code>String</code>, <code>String</code> <strong>)</strong> to change the text in a textbox<br>
  348. Use both parameters to write text in textboxes.</p>
  349. <ul>
  350. <li>In the first parameter, write the objectName.textAttribute example: t0.txt or b0.txt</li>
  351. <li>In the second parameter, write the text you want to “print”</li>
  352. </ul>
  353. <p><em><strong>1st Syntax:</strong></em></p>
  354. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">,</span> <span class="token string">"Hello World"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Change t0 text to "Hello World"</span>
  355. </code></pre>
  356. <p>Any previous text on the textbox is deleted</p>
  357. <p>Avoid using very big text Strings in the same command, as Nextion will not recognise them. Istead use a second command and in order to add to the existing text, use the <strong><code>+</code></strong> symbol, after the <code>.textAttribute("t0.txt+")</code>.</p>
  358. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">,</span> <span class="token string">"You are now transferred to page2\\rThank you\\rfor choosing my library!!!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  359. myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt+"</span><span class="token punctuation">,</span> <span class="token string">"\\rEnjoy the library!!!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  360. myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt+"</span><span class="token punctuation">,</span> <span class="token string">"\\r\\rAthanasios Seitanis\\rseithagta@gmail.com"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  361. <span class="token comment">/* By writing \\r, you send Nextion the change line character &lt; \r &gt;
  362. * The second \ is required, in order to print the \ as character
  363. * and not as an escape character.
  364. */</span>
  365. </code></pre>
  366. <p><strong>Second Usage of the command</strong>:<br>
  367. Use <strong>writeStr(</strong> <code>String</code> <strong>)</strong> to send Designing and System Commands according to the instructions of Nextion’s Instruction Set.<br>
  368. Use only the first parameter to send a command to Nextion. The commands must be syntaxed according to Nextion’s Instruction Set.</p>
  369. <p><em><strong>2nd Syntax:</strong></em><br>
  370. <em><strong>Design Commands Example:</strong></em></p>
  371. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"page page0"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Sending this command to change the page we are on Nextion using pageName</span>
  372. myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"page 1"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Sending this command to change the page we are on Nextion using pageId</span>
  373. </code></pre>
  374. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"cir 100,100,30,RED"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Renders a hollow Red circle with circle center at (100,100)</span>
  375. </code></pre>
  376. <p><em><strong>System Commands Example:</strong></em></p>
  377. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"dim=50"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Set the current brightness level to 50%</span>
  378. </code></pre>
  379. <pre class=" language-cpp"><code class="prism language-cpp">myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"sleep=1"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// sleep=1 (Enter sleep mode) or sleep=0 (Exit sleep mode)</span>
  380. </code></pre>
  381. <p><em><strong>NOTE</strong>: When you decide to exit the sleep mode on Nextion, use a small delay of 50ms, in order to give Nextion some time to Exit sleep mode.</em><br>
  382. <em><strong>WARNING</strong>: DO NOT send commands that causes data return over Serial to MCU, unless you know what you are doing.</em><br>
  383. Commands that cause data return over serial:<br>
  384. <code>print</code>, <code>prints</code>, <code>printh</code>, <code>sendme</code>, <code>get</code>, <code>rept</code>, <code>rdfile</code>, <code>twfile</code><br>
  385. <em><strong>TIP</strong>: Write in the debug mode the command to check if it is written correctly</em></p>
  386. <h3 id="function-readnumber">Function readNumber();</h3>
  387. <p><strong><code>Associated Library's Code Example:</code> <em><code>ReadAndWriteNumber</code></em></strong></p>
  388. <p><em><strong>Parameters:</strong></em><br>
  389. readNumber(<code>String</code>)</p>
  390. <ul>
  391. <li><strong>String</strong>: objectname.numericAttribute (example: “va0.val” “n0.val”, “n0.pco”, “n0.bco”…etc)</li>
  392. </ul>
  393. <p><em><strong>Description:</strong></em><br>
  394. We use it to read the value of every components’ numeric attribute from Nextion (value, bco color, pco color…etc)</p>
  395. <p>In case the function fails to read the new value, it will return the number <code>777777</code>.<br>
  396. The reasons of getting <code>777777</code>: (from release 1.0.2 and above)</p>
  397. <ul>
  398. <li>Waiting bytes have not come to Serial timeout</li>
  399. <li>Command start character is not found in Serial timeout</li>
  400. <li>The waiting length of the byte package has not come to Serial</li>
  401. <li>Bytes on Serial are not the expected<br>
  402. The chances of getting a wrong value is one in a million.<br>
  403. You can use this, fail return value, feature in your code, in case you handle sensitive value data, to confirm that you have the right value.<br>
  404. You can check it with an <strong><code>if()</code></strong> statement, in which you will ignore the value of <code>777777</code> and you can run the <code>readNumber()</code> again or set a safe value or use the last good known value method.</li>
  405. </ul>
  406. <pre class=" language-cpp"><code class="prism language-cpp">uint32_t number <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
  407. uint32_t lastnumber <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
  408. number <span class="token operator">=</span> myNex<span class="token punctuation">.</span><span class="token function">readNumber</span><span class="token punctuation">(</span><span class="token string">"n0.val"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// We read the value of n0 and store it to number variable</span>
  409. <span class="token keyword">if</span><span class="token punctuation">(</span>number <span class="token operator">!=</span> <span class="token number">777777</span><span class="token punctuation">)</span><span class="token punctuation">{</span> <span class="token comment">// 777777is the return value if the code fails to read the new value</span>
  410. lastnumber <span class="token operator">=</span> number<span class="token punctuation">;</span>
  411. <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>number <span class="token operator">==</span> <span class="token number">777777</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  412. number <span class="token operator">=</span> lastNumber<span class="token punctuation">;</span>
  413. <span class="token punctuation">}</span>
  414. </code></pre>
  415. <p><em><strong>Syntax:</strong></em></p>
  416. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">unsigned</span> <span class="token keyword">long</span> x <span class="token operator">=</span> myObject<span class="token punctuation">.</span><span class="token function">readNumber</span><span class="token punctuation">(</span><span class="token string">"n0.val"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Store to x the value of numeric box n0</span>
  417. <span class="token keyword">unsigned</span> <span class="token keyword">long</span> x <span class="token operator">=</span> myObject<span class="token punctuation">.</span><span class="token function">readNumber</span><span class="token punctuation">(</span><span class="token string">"va0.val"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Store to x the value of the variable va0</span>
  418. <span class="token keyword">unsigned</span> <span class="token keyword">int</span> y <span class="token operator">=</span> myObject<span class="token punctuation">.</span><span class="token function">readNumber</span><span class="token punctuation">(</span><span class="token string">"b0.bco"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Strore to y the color number of the background of button b0</span>
  419. </code></pre>
  420. <p><em><strong>NOTE:</strong> Only attributes shown in <strong>green</strong> in the Editor can be both read and changed by user code at runtime.</em><br>
  421. To</p>
  422. <h3 id="function-readstr">Function readStr();</h3>
  423. <p><strong><code>Associated Library's Code Example:</code> <em><code>ReadString</code></em></strong></p>
  424. <p><em><strong>Parameters:</strong></em><br>
  425. readStr(<code>String</code>)</p>
  426. <ul>
  427. <li><strong>String</strong>: objectname.textAttribute (example: “t0.txt”, “va0.txt”, “b0.txt”…etc)</li>
  428. </ul>
  429. <p><em><strong>Description:</strong></em><br>
  430. We use it to read the value of every components’ text attribute from Nextion (txt etc…)</p>
  431. <p>In case the function fails to read the new value, it will return the text <code>ERROR</code>.<br>
  432. The reasons of getting <code>ERROR</code>: (from release 1.0.4 and above)</p>
  433. <ul>
  434. <li>Serial buffer occupied timeout</li>
  435. <li>Waiting bytes have not come to Serial timeout</li>
  436. <li>Command start character is not found in Serial timeout</li>
  437. <li>The end of the command has not come to Serial</li>
  438. </ul>
  439. <p>The chances of getting a wrong value is one in a million.<br>
  440. You can use this, fail return value, feature in your code, in case you handle sensitive value data, to confirm that you have the right value.<br>
  441. You can check it with an <strong><code>if()</code></strong> statement, in which you will ignore the value of <code>ERROR</code> and you can run the <code>readStr()</code> again or set a safe value or use the last good known value method.</p>
  442. <pre class=" language-cpp"><code class="prism language-cpp">String text <span class="token operator">=</span> <span class="token string">""</span><span class="token punctuation">;</span>
  443. String lastText <span class="token operator">=</span> <span class="token string">""</span><span class="token punctuation">;</span>
  444. text <span class="token operator">=</span> myNex<span class="token punctuation">.</span><span class="token function">readStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// We read the value of t0 and store it</span>
  445. <span class="token keyword">if</span><span class="token punctuation">(</span>text<span class="token punctuation">.</span><span class="token function">equals</span><span class="token punctuation">(</span><span class="token string">"ERROR"</span><span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">{</span> <span class="token comment">// ERROR is the return value if the code fails to read the new value</span>
  446. lastText <span class="token operator">=</span> text<span class="token punctuation">;</span>
  447. <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>text<span class="token punctuation">.</span><span class="token function">equals</span><span class="token punctuation">(</span><span class="token string">"ERROR"</span><span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  448. text <span class="token operator">=</span> lastText<span class="token punctuation">;</span>
  449. <span class="token punctuation">}</span>
  450. </code></pre>
  451. <p><em><strong>Syntax:</strong></em></p>
  452. <pre class=" language-cpp"><code class="prism language-cpp">String x <span class="token operator">=</span> myObject<span class="token punctuation">.</span><span class="token function">readStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Store to x the value of text box t0</span>
  453. </code></pre>
  454. <h2 id="library-public-variables">Library Public Variables</h2>
  455. <p><strong><code>Associated Library's Code Example:</code> <em><code>ChangePagesAndSentFloatValues</code></em></strong></p>
  456. <p><em><strong>1st Variable</strong></em>:<br>
  457. <em>currentPageId</em><br>
  458. A variable that stores the ID number of the current page loaded on Nextion. It is <strong>VERY</strong> important that Nextion and Arduino are synced and when you send data, the data goes to the right page.</p>
  459. <p><strong>NOTE</strong>: In order to update this variable with the current Id of the page, you must write the Preinitialize Event of every page: <code>printh 23 02 50 XX</code> , where <code>XX</code> the id of the page in HEX.<br>
  460. For page0: <code>printh 23 02 50 00</code><br>
  461. for page9: <code>printh23 02 50 09</code><br>
  462. for page10: <code>printh 23 02 50 0A</code></p>
  463. <p><em>See Appendix at the end of the document for numbers in HEX table</em></p>
  464. <p>It can be called by writing:</p>
  465. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">int</span> x <span class="token operator">=</span> myObject<span class="token punctuation">.</span>currentPageId<span class="token punctuation">;</span> <span class="token comment">// Store to x the currentPageId</span>
  466. </code></pre>
  467. <p><strong>Example</strong>:</p>
  468. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">if</span><span class="token punctuation">(</span>myObject<span class="token punctuation">.</span>currentPageId <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  469. myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">,</span> <span class="token string">"You are on page0!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  470. <span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>myObject<span class="token punctuation">.</span>currentPageId <span class="token operator">==</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  471. myObject<span class="token punctuation">.</span><span class="token function">writeStr</span><span class="token punctuation">(</span><span class="token string">"t0.txt"</span><span class="token punctuation">,</span> <span class="token string">"You are on page1!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  472. <span class="token punctuation">}</span>
  473. </code></pre>
  474. <p><em><strong>2nd Variable</strong></em>:<br>
  475. <em>lastCurrentPageId</em><br>
  476. This variable stores the last value of <code>currentPageId</code> before <code>currentPageId</code> is changed. We use it to check if the page we are on has changed, in order to send refreshing screen data to the components of the page.</p>
  477. <p>After that, it can be set to equal with the <code>currentPageId</code>, in order not to send unnecessary data for refreshing the components.</p>
  478. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">if</span><span class="token punctuation">(</span>myObject<span class="token punctuation">.</span>currentPageId <span class="token operator">!=</span> myObject<span class="token punctuation">.</span>lastCurrentPageId<span class="token punctuation">)</span><span class="token punctuation">{</span>
  479. <span class="token keyword">if</span><span class="token punctuation">(</span>myObject<span class="token punctuation">.</span>currentPageId <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  480. <span class="token punctuation">[</span>send the data to refresh the page0<span class="token punctuation">]</span>
  481. <span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>myObject<span class="token punctuation">.</span>currentPageId <span class="token operator">==</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  482. <span class="token punctuation">[</span>send the data to refresh the page1<span class="token punctuation">]</span>
  483. <span class="token punctuation">}</span>
  484. myObject<span class="token punctuation">.</span>lastCurrentPageId <span class="token operator">=</span> myObject<span class="token punctuation">.</span>currentPageId<span class="token punctuation">;</span>
  485. <span class="token punctuation">}</span>
  486. </code></pre>
  487. <p>Find more on the Library’s Example: <em><code>ChangePagesAndSentFloatValues</code></em><br>
  488. <em><strong>TIP</strong>: You can read the ID of the current Loaded page at anytime, without the use of the Library’s commands using the <code>dp</code> system command</em></p>
  489. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">int</span> x <span class="token operator">=</span> myObject<span class="token punctuation">.</span><span class="token function">readNumber</span><span class="token punctuation">(</span><span class="token string">"dp"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Store to x the ID of the current Loaded page</span>
  490. </code></pre>
  491. <h3 id="function-easynexreadcustomcommand">Function easyNexReadCustomCommand()</h3>
  492. <p><code>easyNexReadCustomCommand()</code> has a weak attribute and will be created only when user<br>
  493. declares this function in the main code.<br>
  494. More for custom protocol and commands <a href="https://seithan.com/Easy-Nextion-Library/Custom-Protocol/">https://seithan.com/Easy-Nextion-Library/Custom-Protocol/</a><br>
  495. Our commands will have this format: <code>#</code> <code>len</code> <code>cmd</code> <code>id</code> <code>id2</code><br>
  496. and we must send them from Nextion as HEX with the printh command.<br>
  497. For example: <code>printh 23 03 4C 01 01</code></p>
  498. <ul>
  499. <li><code>#</code> start marker, declares that a command follows</li>
  500. <li><code>len</code> declares the number of bytes that will be received</li>
  501. <li><code>cmd</code> declares the task of the command or command group</li>
  502. <li><code>id</code> declares the properties of the command</li>
  503. <li><code>id2</code> a second property for the command</li>
  504. </ul>
  505. <p>When we send a custom command with the above format, the function NextionListen() will capture the start marker <code>#</code> and the <code>len</code> (first 2 bytes) and it will wait until all the bytes of the command, as we have declared with the <code>len</code> byte, arrive to the Serial buffer and inside the timeout limits.<br>
  506. After that, the function will read the next byte, which is the command group and the function <code>readCommand()</code> takes over and through a switch command tries to match the <code>_cmd</code> variable that holds the command group value with the statements of the cases.<br>
  507. If we do NOT have a match with the predefined, <code>cmd</code> of <code>P</code> for page and <code>T</code> for triggers, it will continue to the default where we store the <code>_cmd</code> and <code>_len</code> to the public variables <code>cmdGroup</code> and <code>cmdLenght</code> as we are going to need access to them from the main code in the next step.<br>
  508. Next we call the the <code>easyNexReadCustomCommand()</code> with the precondition and ONLY if we have declared the function in the main code.<br>
  509. From this point we can handle the assign of <code>cmdGroup</code> and <code>IDs</code> from the <code>easyNexReadCustomCommand()</code> in the user code, where we can go on with a switch case<br>
  510. for the <code>cmdGroup</code>, the one that we have stored the <code>_cmd</code> for public use and we can call it with <code>myObject.cmdGroup</code>. This is why we made <code>cmdGroup</code> a public variable.</p>
  511. <p>As an example, we use 2 arrays (tables) of integers, where we are going to change the value of the position (element) with custom commands.</p>
  512. <pre class=" language-cpp"><code class="prism language-cpp"> <span class="token keyword">int</span> dataL<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span> <span class="token comment">//values 0 or 255, because we use only one byte</span>
  513. <span class="token keyword">int</span> dataS<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">;</span> <span class="token comment">// values from 0 to 255, because we use only one byte</span>
  514. </code></pre>
  515. <p>The format is the known: <code>#</code> <code>len</code> <code>cmd</code> <code>id</code> <code>id2</code></p>
  516. <ul>
  517. <li>where the <code>id</code> referred to the position (element) of the array we want to write on</li>
  518. <li>And <code>id2</code> carries the value to be written on the element of array.</li>
  519. </ul>
  520. <p>The custom command from Nextion: <code>printh 23 03 4C 00 0A</code></p>
  521. <ul>
  522. <li>4C is the Hex for letter L and we refer to the array <code>dataL[]</code></li>
  523. <li>00 Hex of Dec number 0 used as the index for each array element</li>
  524. <li>0A Hex of Dec number 10 is the value we are going to write on element 0</li>
  525. </ul>
  526. <p>After the command is executed by our code, the values on <code>dataL[]</code> array will be</p>
  527. <ul>
  528. <li>dataL[4] = {10,0,0,0}</li>
  529. </ul>
  530. <p>Same for the dataS[] intead that cmd is the 53 in Hex for letter <code>S</code></p>
  531. <pre class=" language-cpp"><code class="prism language-cpp"><span class="token keyword">void</span> <span class="token function">easyNexReadCustomCommand</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
  532. <span class="token keyword">int</span> arrayPlace<span class="token punctuation">;</span> <span class="token comment">// temp variable</span>
  533. <span class="token keyword">int</span> value<span class="token punctuation">;</span> <span class="token comment">// temp variable</span>
  534. <span class="token keyword">switch</span><span class="token punctuation">(</span>myNex<span class="token punctuation">.</span>cmdGroup<span class="token punctuation">)</span><span class="token punctuation">{</span>
  535. <span class="token keyword">case</span> <span class="token string">'L'</span><span class="token operator">:</span> <span class="token comment">// Or &lt;case 0x4C:&gt; If 'L' matches</span>
  536. <span class="token comment">// we are going to write values in specific places in the dataL[] table</span>
  537. <span class="token comment">// read the next byte that determines the position on the table</span>
  538. arrayPlace <span class="token operator">=</span> myNex<span class="token punctuation">.</span><span class="token function">readByte</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  539. <span class="token comment">// read the next byte that keeps the value for the position</span>
  540. value <span class="token operator">=</span> myNex<span class="token punctuation">.</span><span class="token function">readByte</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  541. <span class="token comment">// update the array with the new values</span>
  542. dataL<span class="token punctuation">[</span>arrayPlace<span class="token punctuation">]</span> <span class="token operator">=</span> value<span class="token punctuation">;</span>
  543. <span class="token keyword">break</span><span class="token punctuation">;</span>
  544. <span class="token keyword">case</span> <span class="token string">'S'</span><span class="token operator">:</span> <span class="token comment">// Or &lt;case 0x53:&gt; If 'S' matches </span>
  545. <span class="token comment">// we are going to write values in specific places in the dataS[] table</span>
  546. <span class="token comment">// from Nextion printh 23 03 53 00 00</span>
  547. <span class="token comment">// read the next byte that determines the position on the table</span>
  548. arrayPlace <span class="token operator">=</span> myNex<span class="token punctuation">.</span><span class="token function">readByte</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  549. <span class="token comment">// read the next byte that keeps the value for the position</span>
  550. value <span class="token operator">=</span> myNex<span class="token punctuation">.</span><span class="token function">readByte</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  551. <span class="token comment">// update the array with the new values</span>
  552. dataS<span class="token punctuation">[</span>arrayPlace<span class="token punctuation">]</span> <span class="token operator">=</span> value<span class="token punctuation">;</span>
  553. <span class="token keyword">break</span><span class="token punctuation">;</span>
  554. <span class="token punctuation">}</span>
  555. <span class="token punctuation">}</span>
  556. </code></pre>
  557. <h2 id="usefull-tips">Usefull Tips</h2>
  558. <p><strong>Manage Variables</strong><br>
  559. You can read/write the variables as any other component.</p>
  560. <p>Use <code>readNumber()</code> to read the value of a numeric variable.<br>
  561. Example: <code>myNex.readNumber("va0.val");</code><br>
  562. <strong>BUT:</strong> <code>myNex.readNumber("sys0");</code></p>
  563. <p>Use <code>writeNum()</code> to change the value of a numeric variable.<br>
  564. Example: <code>myNex.writeNum("va0.val", 255);</code><br>
  565. <strong>BUT:</strong> <code>myNex.readNumber("sys0", 375);</code></p>
  566. <p>Use <code>readStr()</code> to read the text of a String variable.<br>
  567. Example: <code>myNex.readStr("va0.txt");</code></p>
  568. <p>Use <code>writeStr()</code> to change the text of a String variable.<br>
  569. Example: <code>myNex.writeStr("va0.txt", "Hello World");</code><br>
  570. For this to happen, the variables you want to read/write must be at the page you are currently on.<br>
  571. Otherwise, if the variables are of <strong>global</strong> scope, you will need to use a prefix with the page name that the variables are at.<br>
  572. Example:<br>
  573. <code>myNex.readNumber("page0.va0.val");</code> // If the variable is at page0<br>
  574. The same goes for the other functions as well.</p>
  575. <h2 id="compatibility">Compatibility</h2>
  576. <ul>
  577. <li>Arduino</li>
  578. <li>ESP</li>
  579. </ul>
  580. <p>Tested MCUs:</p>
  581. <ol>
  582. <li>Arduino NANO</li>
  583. <li>Arduino MEGA 2560</li>
  584. <li>Arduino UNO</li>
  585. <li>WeMos D1 mini ESP8266</li>
  586. </ol>
  587. <h2 id="releases">Releases:</h2>
  588. <h3 id="release-1.0.5">Release 1.0.5</h3>
  589. <ul>
  590. <li>Updated <code>readNumber()</code> function for faster response and more accurate reading.</li>
  591. <li>Added the <code>readByte()</code> function for reading Serial buffer from user code</li>
  592. <li>Added <code>easyNexReadCustomCommand()</code> function with a weak attribute and will be created only when user declares this function in the main code. The motivation to move this function out of the library’s files, comes from Ricardo Reis thanks to his issue <a href="https://github.com/Seithan/EasyNextionLibrary/issues/15">https://github.com/Seithan/EasyNextionLibrary/issues/15</a></li>
  593. <li>Added public variables <code>cmdGroup</code> and <code>cmdLength</code> <strong>ONLY</strong> for read custom commands, stores the command group ID and the length of the command</li>
  594. </ul>
  595. <h3 id="release-1.0.4">Release 1.0.4</h3>
  596. <ul>
  597. <li>Added the readStr() function for reading a String from Nextion</li>
  598. </ul>
  599. <h3 id="release-1.0.3">Release 1.0.3</h3>
  600. <p>Two more examples were added.</p>
  601. <ul>
  602. <li>The first one demonstrates how to use EasyNextionLibrary with waveforms.</li>
  603. <li>The second one demonstrates how to use EasyNextionLibrary with progress bars</li>
  604. </ul>
  605. <h3 id="release-1.0.2">Release 1.0.2</h3>
  606. <ul>
  607. <li>Remove the private function <code>readCommand()</code> from the main <code>EasyNextionLibrary.cpp</code> file. A new file is created named <code>readCustomCommands.cpp</code>, in order to make easier the modifications for it when using the custom protocol.</li>
  608. <li>Return Error code added and to other cases of <code>readNumberFromSerial()</code>. When failing to read a number, we return the number 777777 instead. The cases of having a 777777 return:
  609. <ul>
  610. <li>Waiting bytes have not come to Serial timeout</li>
  611. <li>Command start character is not found in Serial timeout</li>
  612. <li>The waiting length of the byte package has not come to Serial</li>
  613. <li>Bytes on Serial are not the expected</li>
  614. </ul>
  615. </li>
  616. <li>The function readNumberFromSerial() is improved, making reading values more accurate, due to hardware or Serial problems.</li>
  617. </ul>
  618. <h2 id="licence">Licence</h2>
  619. <p>This library is licensed under <strong>MIT X11 license</strong>.<br>
  620. Copyright © &lt;2020&gt; Athanasios Seitanis</p>
  621. <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
  622. <p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
  623. <p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
  624. <p>Except as contained in this notice, the name of Athanasios Seitanis or the name of EasyNextionLibrary shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Athanasios Seitanis.<br>
  625. Also, prior written permission is required if this software or any part of it or any modifications of it, are used for commercial purposes.</p>
  626. <p>By using this software, you agree with the above terms and conditions as they are.<br>
  627. The owner of the software has the right to change the terms of this license at any time without a prior notification.</p>
  628. <h2 id="appendix">Appendix</h2>
  629. <h3 id="numbers-in-hex">Numbers in HEX:</h3>
  630. <table>
  631. <thead>
  632. <tr>
  633. <th>DEC</th>
  634. <th>HEX</th>
  635. <th>-</th>
  636. <th>DEC</th>
  637. <th>HEX</th>
  638. <th>-</th>
  639. <th>DEC</th>
  640. <th>HEX</th>
  641. <th>-</th>
  642. <th>DEC</th>
  643. <th>HEX</th>
  644. </tr>
  645. </thead>
  646. <tbody>
  647. <tr>
  648. <td>0</td>
  649. <td><strong>00</strong></td>
  650. <td>-</td>
  651. <td>16</td>
  652. <td><strong>10</strong></td>
  653. <td>-</td>
  654. <td>32</td>
  655. <td><strong>20</strong></td>
  656. <td>-</td>
  657. <td>48</td>
  658. <td><strong>30</strong></td>
  659. </tr>
  660. <tr>
  661. <td>1</td>
  662. <td><strong>01</strong></td>
  663. <td>-</td>
  664. <td>17</td>
  665. <td><strong>11</strong></td>
  666. <td>-</td>
  667. <td>33</td>
  668. <td><strong>21</strong></td>
  669. <td>-</td>
  670. <td>49</td>
  671. <td><strong>31</strong></td>
  672. </tr>
  673. <tr>
  674. <td>2</td>
  675. <td><strong>02</strong></td>
  676. <td>-</td>
  677. <td>18</td>
  678. <td><strong>12</strong></td>
  679. <td>-</td>
  680. <td>34</td>
  681. <td><strong>22</strong></td>
  682. <td>-</td>
  683. <td>50</td>
  684. <td><strong>32</strong></td>
  685. </tr>
  686. <tr>
  687. <td>3</td>
  688. <td><strong>03</strong></td>
  689. <td>-</td>
  690. <td>19</td>
  691. <td><strong>13</strong></td>
  692. <td>-</td>
  693. <td>35</td>
  694. <td><strong>23</strong></td>
  695. <td>-</td>
  696. <td>51</td>
  697. <td><strong>33</strong></td>
  698. </tr>
  699. <tr>
  700. <td>4</td>
  701. <td><strong>04</strong></td>
  702. <td>-</td>
  703. <td>20</td>
  704. <td><strong>14</strong></td>
  705. <td>-</td>
  706. <td>36</td>
  707. <td><strong>24</strong></td>
  708. <td>-</td>
  709. <td>52</td>
  710. <td><strong>34</strong></td>
  711. </tr>
  712. <tr>
  713. <td>5</td>
  714. <td><strong>05</strong></td>
  715. <td>-</td>
  716. <td>21</td>
  717. <td><strong>15</strong></td>
  718. <td>-</td>
  719. <td>37</td>
  720. <td><strong>25</strong></td>
  721. <td>-</td>
  722. <td>53</td>
  723. <td><strong>35</strong></td>
  724. </tr>
  725. <tr>
  726. <td>6</td>
  727. <td><strong>06</strong></td>
  728. <td>-</td>
  729. <td>22</td>
  730. <td><strong>16</strong></td>
  731. <td>-</td>
  732. <td>38</td>
  733. <td><strong>26</strong></td>
  734. <td>-</td>
  735. <td>54</td>
  736. <td><strong>36</strong></td>
  737. </tr>
  738. <tr>
  739. <td>7</td>
  740. <td><strong>07</strong></td>
  741. <td>-</td>
  742. <td>23</td>
  743. <td><strong>17</strong></td>
  744. <td>-</td>
  745. <td>39</td>
  746. <td><strong>27</strong></td>
  747. <td>-</td>
  748. <td>55</td>
  749. <td><strong>37</strong></td>
  750. </tr>
  751. <tr>
  752. <td>8</td>
  753. <td><strong>08</strong></td>
  754. <td>-</td>
  755. <td>24</td>
  756. <td><strong>18</strong></td>
  757. <td>-</td>
  758. <td>40</td>
  759. <td><strong>28</strong></td>
  760. <td>-</td>
  761. <td>56</td>
  762. <td><strong>38</strong></td>
  763. </tr>
  764. <tr>
  765. <td>9</td>
  766. <td><strong>09</strong></td>
  767. <td>-</td>
  768. <td>25</td>
  769. <td><strong>19</strong></td>
  770. <td>-</td>
  771. <td>41</td>
  772. <td><strong>29</strong></td>
  773. <td>-</td>
  774. <td>57</td>
  775. <td><strong>39</strong></td>
  776. </tr>
  777. <tr>
  778. <td>10</td>
  779. <td><strong>0A</strong></td>
  780. <td>-</td>
  781. <td>26</td>
  782. <td><strong>1A</strong></td>
  783. <td>-</td>
  784. <td>42</td>
  785. <td><strong>2A</strong></td>
  786. <td>-</td>
  787. <td>58</td>
  788. <td><strong>3A</strong></td>
  789. </tr>
  790. <tr>
  791. <td>11</td>
  792. <td><strong>0B</strong></td>
  793. <td>-</td>
  794. <td>27</td>
  795. <td><strong>1B</strong></td>
  796. <td>-</td>
  797. <td>43</td>
  798. <td><strong>2B</strong></td>
  799. <td>-</td>
  800. <td>59</td>
  801. <td><strong>3B</strong></td>
  802. </tr>
  803. <tr>
  804. <td>12</td>
  805. <td><strong>0C</strong></td>
  806. <td>-</td>
  807. <td>28</td>
  808. <td><strong>1C</strong></td>
  809. <td>-</td>
  810. <td>44</td>
  811. <td><strong>2C</strong></td>
  812. <td>-</td>
  813. <td>60</td>
  814. <td><strong>3C</strong></td>
  815. </tr>
  816. <tr>
  817. <td>13</td>
  818. <td><strong>0D</strong></td>
  819. <td>-</td>
  820. <td>29</td>
  821. <td><strong>1D</strong></td>
  822. <td>-</td>
  823. <td>45</td>
  824. <td><strong>2D</strong></td>
  825. <td>-</td>
  826. <td>61</td>
  827. <td><strong>3D</strong></td>
  828. </tr>
  829. <tr>
  830. <td>14</td>
  831. <td><strong>0E</strong></td>
  832. <td>-</td>
  833. <td>30</td>
  834. <td><strong>1E</strong></td>
  835. <td>-</td>
  836. <td>46</td>
  837. <td><strong>2E</strong></td>
  838. <td>-</td>
  839. <td>62</td>
  840. <td><strong>3E</strong></td>
  841. </tr>
  842. <tr>
  843. <td>15</td>
  844. <td><strong>0F</strong></td>
  845. <td>-</td>
  846. <td>31</td>
  847. <td><strong>1F</strong></td>
  848. <td>-</td>
  849. <td>47</td>
  850. <td><strong>2F</strong></td>
  851. <td>-</td>
  852. <td>63</td>
  853. <td><strong>3F</strong></td>
  854. </tr>
  855. </tbody>
  856. </table></div>
  857. </body>
  858. </html>