logo elektroda
logo elektroda
X
logo elektroda

Video tutorial displays NEXTION

ekrzychoooo 47055 274

TL;DR

  • A new video guide for NEXTION displays is being created.
  • The guide is presented as a YouTube playlist.
  • NEXTION displays are the only named topic, so the playlist is a focused resource for anyone learning that display platform.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • #121 17951484
    zeniuzeniu
    Level 11  
    Posts: 36
    What fonts do you use to make the text look nice, for example, in the "SETTINGS" inscription there are no visible spaces after the "I" and the reduced "W" because it looks something like "SETTING A".
  • ADVERTISEMENT
  • #122 17951539
    Anonymous
    Level 1  
  • #123 17951829
    zeniuzeniu
    Level 11  
    Posts: 36
    Approx. Thanks. I found ;)
  • #124 17983036
    comer3
    Level 27  
    Posts: 746
    Help: 123
    Rate: 55
    Hello,

    Gentlemen, have any of you already captured information by Arduino from Nextion when the display comes out of sleep mode after touching? By connecting the display with the computer after waking up (touching) I register 0x87 FF FF FF in the console, but when I want to catch it on the uC, nothing shows up in the console.

    Below is a simplified code - but probably not that way (the code does not work) and it will have to be done using the library, unfortunately I'm not that proficient with these bricks. Anyone show me what the code should look like using a library reference?

    Code: C / C++
    Log in, to see the code


    In my program, arduino reads the time from the DS1307 and sends the time to the display every minute (and this works until the display goes to sleep). When the display is in sleep mode, after waking up, it has the time before entering the sleep mode (although the current time is sent every minute after RSie), so I want the uC to know when the display wakes up so that it can send the correct time at that moment. to display (refresh) it on the screen.
  • #125 17983593
    Anonymous
    Level 1  
  • #126 17983855
    comer3
    Level 27  
    Posts: 746
    Help: 123
    Rate: 55
    Quote:
    And what is that?

    "#define NextionRS Serial"


    Giving your own name to the Serial0 uC port. I call Serial1 (DebugRS), Serial2 (CompRS), etc. similarly - then when writing / analyzing the code, I immediately see which port the data is going to.

    Quote:
    How did you do that you can read incoming data and your library works?


    I just didn't do ... The above code does not work, because as you write data from the port, the library catches my question, whether any of the forum members managed to do something like that. I suspect that you will have to modify the library - here someone worked on the topic, but gave up - https://community.particle.io/t/iteadlib-nextion-library-device-return-data-question/41420
  • #127 17983893
    Anonymous
    Level 1  
  • #128 17984355
    comer3
    Level 27  
    Posts: 746
    Help: 123
    Rate: 55
    I was thinking about this too, and I will probably have to do it because I still have free serial ports, and the processor must know when the display comes out of sleep mode.
  • ADVERTISEMENT
  • #129 17984482
    Anonymous
    Level 1  
  • #130 18094550
    Anonymous
    Level 1  
  • #132 18406988
    darlin
    Level 11  
    Posts: 20
    Thanks for a lot of work in making such a tutrial. Thus, life became easier.
    During the development of the display, I encountered such a problem:
    The Nextiona project has two PAGE pages
    0 Page is used to monitor states of arduino. There is a numeric field n0, Gauge z0 and a button b0
    1 Page is used to control the Arduino. There is a b2 button

    The problem concerns the handling of Callbacks

    if I do it on the same page then after pressing b0 the indicator z0 moves to the value 20. So it works as I want (;
    void b0PopCallback (void * ptr) {
    z0.setValue (20);
    digitalWrite (led, LOW);
    }

    but if I do it from button b2 from Page 1 and Callback:

    void b2PopCallback (void * ptr) {
    v0.setValue (19);
    z0.setValue (90);
    n0.setValue (100);
    digitalWrite (led, HIGH);
    }

    are numerical values, gauge on side 0 does not change. As if the callback from page 1 did not support page 0. Of course, it lights the LED.

    buttons, gauges, and buttons are set to global.
    I also tried via the global variable v0 on page 0 - but it doesn't help either.

    What's the problem?

    ps. or maybe they are displayed only when I return from page 1 to 0, they are deleted? how to check?
  • ADVERTISEMENT
  • #133 18407067
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    Show how you have defined in arduino v0 z0 and n0.
  • #134 18407174
    darlin
    Level 11  
    Posts: 20
    NexButton b0 = NexButton (0.12, "b0");
    NexButton b2 = NexButton (1,3, "b0");
    NexNumber n0 = NexNumber (0.4, "n0");
    NexTimer tm0 = NexTimer (3,4, "tm0");
    NexVariable v0 = NexVariable (0.11, "va0");
    NexText t4 = NexText (0.14, "t4");
    NexGauge z0 = NexGauge (0.2, "z0");
  • #135 18407195
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    If page zero is p0 then try it
    Code: C / C++
    Log in, to see the code

    And if page0 is:
    Code: C / C++
    Log in, to see the code
  • #136 18407223
    darlin
    Level 11  
    Posts: 20
    You are great! thank you.

    Added after 27 [minutes]:

    I have one more question.
    on page2 (next number 3 and id 0) I put the timer tm0 with id4

    I expected to write an entry in arduino

    NexTimer tm0 = NexTimer (3,4, "page2.tm0"); but it doesn't work that way.
    it works for this:
    NexTimer tm0 = NexTimer (0.4, "page2.tm0");

    I have id in my page attributes but they are all 0 and cannot be changed. This is some kind of mistake?
    So what are we really listing first? Go? or the sequence number of the page? and if id, why do i have all 0?
  • #137 18407390
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    In your library directory you have a doc \ Documentation \ folder, run index.html there
    Then Modules-> NexTimer
    and there is a constructor definition:

    Code: C / C++
    Log in, to see the code


    Quote:
    and if id, why do i have all 0?
    these are the IDs of the elements on each page, and the page is the most important element on the page :-) so ID = 0

    Do not be afraid to bury in these libraries and after analyzing, for example, the setValue (value) function, you can see that arduino is selected for these elements by name and not by id.
  • ADVERTISEMENT
  • #138 18407449
    darlin
    Level 11  
    Posts: 20
    and there was light (: thanks

    Added after 3 [hours] 18 [minutes]:

    I know I'm whining, but the last question today (;

    I have a website where I replace its picture with the hotspot event (background).
    if (p0.pic == 2)
    {p0.pic = 3
    }
    else
    {
    p0.pic = 2
    }
    and this substitution works, but by the way, other elements on this page disappear.
    I will add that the elements will show if I click where they should be ... Spells normally (;
  • #139 18408051
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    Are you sure you have a page named p0?
    Are you sure you have pictures with id = 2 and id = 3?
    Is it happening in the debugger or already in the display?
    and this line
    Code: C / C++
    Log in, to see the code

    does not crash you error?
  • #140 18408249
    darlin
    Level 11  
    Posts: 20
    p0 to picture p0 with picture pic number 2.
    Of course I have pictures 2 and 3.
    This replacement works in both the debugger and the display. Does not generate any errors,
    but as I mentioned it hides (or maybe arranges under the picture) other elements (button, numeric field).
  • #141 18408301
    Anonymous
    Level 1  
  • #142 18408326
    darlin
    Level 11  
    Posts: 20
    Helpful suggestion. Thanks.

    it helped
    ref 5
    ref 6
  • #143 18408359
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    Maybe it would be easier:
    Code: C / C++
    Log in, to see the code
  • #144 18408382
    darlin
    Level 11  
    Posts: 20
    This is how the compiler reports an error.
    I do not have pictures attached directly to the page (can you?),
    only for p0 container.
  • #145 18408436
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    Yes.
    Change the page background from plain to picture.
  • #146 18408478
    darlin
    Level 11  
    Posts: 20
    I didn't notice this attribute.
    Yes, it is much better this way. Thanks.

    One more problem bothers me (;
    One button sends me the values of multiple numeric fields to aruino:
    get "a"
    get n0.val
    get "b"
    get n1.val
    .....
    65 04 05 00 FF FF FF
    70 61 FF FF FF
    71 02 00 00 00 FF FF FF
    70 62 FF FF FF
    71 2C 00 00 00 FF FF FF

    For separation and further processing in arduino I separated the values with char character.

    Is there any better way to send multiple values at once?
  • #147 18408489
    Anonymous
    Level 1  
  • #148 18408531
    ekrzychoooo
    Level 17  
    Posts: 279
    Help: 24
    Rate: 73
    At the time when I was creating this tutorial, I was getting a lot of e-mails asking me to correct the code.
    A mistake of a more logistic nature was often made. There was no set center of gravity for the application in these codes.
    Application in arduino, on the other hand, a great temptation to take advantage of the LCD software. As a result, a code was created in which arduino managed the LCD and the LCD managed the application in arduino. With the expanding project, it was already hard to control.
    I think the app should be in arduino and she should be as MASTER . The LCD programming capabilities should be used with moderation and caution.
    You press the button to catch this callback, but let arduino download what it needs.

    And what do your applications look like? What do you think about this?
  • #149 18408924
    darlin
    Level 11  
    Posts: 20
    The third day I deal with the display. I'm just gaining experience.
    And I toss as you type, between the display code and the arduino to suit the needs of the project.
    This thrashing is largely due to the tutorials you've watched.
    But thanks to your support, I get an overview of how it can work and how I want it to work.

    I rewrote the code to the arduino website,
    n6.getValue (& n);
    it works too, but it's actually much better to handle the code.
    Thanks!
  • #150 18414314
    darlin
    Level 11  
    Posts: 20
    How to scale nex.Gauge so that after receiving val = 0 it would set the pointer to 310 and for val = 180 it would set the pointer to 230?
    with 90 = 90.
    That is the question!

    Added after 1 [hours] 50 [minutes]:

    I rushed with this question (;
    solving the puzzle from the arduino side:
    z = map (pos, 0, 180, 310, 585);
    if (z> 359)
    {
    z = z - 360;
    }
📢 Listen (AI):

Topic summary

✨ The discussion centers on creating and using video tutorials for NEXTION displays, focusing on practical implementation with Arduino and ESP8266/ESP-12 microcontrollers. Key topics include programming dual-state buttons, sending commands from Arduino to control multiple buttons or relays, and managing page navigation on the NEXTION display via serial commands. Users share code examples for integrating thermistor and thermocouple temperature sensors, relay control, and waveform display elements. Challenges addressed include proper serial port configuration, especially when switching from Arduino UNO to MEGA2560 or ESP8266, and handling communication issues such as display freezing when updating text fields intensively. The importance of correct object declarations, event handling (e.g., touch release events), and efficient serial communication to avoid flooding the display is emphasized. Solutions for wireless communication using Bluetooth modules (HC-05, HC-06) are mentioned. The discussion also covers font selection for Polish characters, EEPROM data storage formats, and converting checkbox states into binary numbers for transmission. Users highlight the necessity of using microcontrollers with multiple hardware serial ports for simultaneous display and PC communication, as software serial is unstable. The use of Nextion Editor's debug console for monitoring communication and troubleshooting is recommended. Finally, advice is given on using scrolling text components for displaying large text files from SD cards and managing UART buffer limitations.
Generated by the language model.

FAQ

TL;DR: “Send page 1 and it must work” [Elektroda, Slawek K., post #17619813] A single page command fixes 90 % of navigation issues while 77 % SRAM usage already triggers instability warnings [Elektroda, darlin, post #18453905] Why it matters: mastering one-line serial commands prevents lock-ups and slashes debug time.

Quick Facts

• Default baud-rate: 9600 bps (set with bauds=9600) [Nextion Instr.Set]. • EEPROM size on Basic series: 1024 bytes, 4 bytes per wepo number [Elektroda, ekrzychoooo, post #17535690] • Available GPIO lines on Enhanced/Intelligent: 8 (4 PWM-capable) [Nextion Instr.Set]. • RAM warning level: > 80 % global usage; Nano crash reported at 89 % [Elektroda, darlin, post #18453905]tft upload over UART: ~25 kB min⁻¹ at 115 kbaud [ITEAD Docs].

How do I change pages from Arduino?

Send a plain text command: Serial.print("page 2\xFF\xFF\xFF");. The triple 0xFF terminators are mandatory. Users confirmed it works on Uno, Mega and ESP when nexSerial matches the connected UART [Elektroda, Slawek K., post #17619813]

The command `0x66 0x02` did nothing—why?

0x66 is a response from Nextion, not a command to it. Always use human-readable instructions (page, vis, click) followed by three 0xFF bytes when sending from the MCU [Nextion Instr.Set].

Why does my Dual-State Button reset after switching pages?

Local (vscope=local) attributes clear when you leave a page. Declare the val variable as global or copy it to a global va object before navigation, then reload it in the destination page’s Preinitialize event [Elektroda, ekrzychoooo, post #19364268]

How can I read which page is currently displayed?

Issue sendme from Arduino; Nextion replies with 0x66 0xPP 0xFF 0xFF 0xFF, where PP is the page ID. Parse the second byte to know the active page [Nextion Instr.Set].

My text flashes and returns `0x1A` errors—what’s wrong?

0x1A means “Invalid variable or attribute”. Check that object names and IDs in your Arduino code exactly match the HMI file; mismatched names (e.g., page0.n1 vs n1) caused this in several projects [Elektroda, rs6000, post #17434161]

Can I store multiple integers in EEPROM?

Yes—each wepo stores a 4-byte signed long. Address them at 4-byte intervals (0,4,8…). Using 6-byte spacing just wastes space and is not required [Elektroda, ekrzychoooo, post #17535690]

What’s the safest way to update a value only when it changes?

  1. Read the new value into valNew.
  2. If valNew != valPrev, send it with pageX.obj.val=valNew.
  3. Set valPrev = valNew. This cuts serial traffic by ~50 % in logging tests [Elektroda, Slawek K., post #18690561]

How do I invert a Progress Bar (countdown style)?

Set the bar value to 100-(curr*100)/total. Example for a 160-second timer: j0.val=100-(100*myTimer.val)/160 in the Timer event [Elektroda, ekrzychoooo, post #18898441]

Is it possible to overwrite the bootloader or font chip via SD?

No. The SD or UART uploader only writes the external SPI flash (25Q32) that stores the HMI project. The bootloader resides inside the STM32 and is read-protected [ITEAD Docs]. A white screen after upload usually means a corrupt TFT file, faulty SD slot, or dead backlight [Elektroda, janwoj111, post #20592222]
Generated by the language model.
ADVERTISEMENT