logo elektroda
logo elektroda
X
logo elektroda

Video tutorial displays NEXTION

ekrzychoooo 41175 274
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #121 17951484
    zeniuzeniu
    Level 11  
    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  
  • #124 17983036
    comer3
    Level 27  
    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  
    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  
  • ADVERTISEMENT
  • #128 17984355
    comer3
    Level 27  
    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.
  • #129 17984482
    Anonymous
    Level 1  
  • #130 18094550
    Anonymous
    Level 1  
  • #132 18406988
    darlin
    Level 11  
    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  
    Show how you have defined in arduino v0 z0 and n0.
  • #134 18407174
    darlin
    Level 11  
    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");
  • ADVERTISEMENT
  • #135 18407195
    ekrzychoooo
    Level 17  
    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  
    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  
    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.
  • #138 18407449
    darlin
    Level 11  
    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  
    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  
    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  
    Helpful suggestion. Thanks.

    it helped
    ref 5
    ref 6
  • #143 18408359
    ekrzychoooo
    Level 17  
    Maybe it would be easier:
    Code: C / C++
    Log in, to see the code
  • #144 18408382
    darlin
    Level 11  
    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  
    Yes.
    Change the page background from plain to picture.
  • #146 18408478
    darlin
    Level 11  
    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  
    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  
    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  
    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;
    }

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.
Summary generated by the language model.
ADVERTISEMENT