logo elektroda
logo elektroda
X
logo elektroda

Video tutorial displays NEXTION

ekrzychoooo 40842 274
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #151 18415222
    darlin
    Level 11  
    the description of Nextion exchange mentions 8 available GPIO ports.
    How to use them? (from nextion's page)
  • ADVERTISEMENT
  • #152 18415343
    ekrzychoooo
    Level 17  
    Menu-> Help-> Instruction Set
    Everything is there
    Code: text
    Log in, to see the code
  • #153 18415348
    Anonymous
    Level 1  
  • #154 18435167
    darlin
    Level 11  
    Is it possible to validate the values entered into the number field from the nextion level?
    e.g., only a range of 0 to 500
  • ADVERTISEMENT
  • #155 18435414
    ekrzychoooo
    Level 17  
    You probably can. In one video I showed how to choose the keyboard operation code. You can modify it to do validation.
  • #156 18453905
    darlin
    Level 11  
    Eh ... I had to add (declare) another 10 controls to the project and I crashed into a wall of missing memory in arduino nano:

    ... "The sketch uses 9058 bytes (29%) of program memory. Maximum is 30720 bytes.
    Global variables use 1594 bytes (77%) of dynamic memory, leaving 454 bytes for local variables. The maximum is 2048 bytes.
    Low available memory, may experience stability problems ... "...

    in total, that's 35 controls.
    Can it be remedied or optimized?
  • #157 18454512
    ekrzychoooo
    Level 17  
    darlin wrote:
    Global variables use 1594 bytes (77%) of dynamic memory

    A large project for a nano. On the other hand, if we only estimate 4 bytes (or as many as 4) for a variable, then 398 variables come out.
    Don't you have any large declared arrays in the global?
    Subtract some control from the project, preferably the one you have the most, and enter how much has decreased. As it will be known what control is, you can combine something here. Although without the code ...
  • ADVERTISEMENT
  • #158 18454538
    darlin
    Level 11  
    Subtract 10 controls of type NexNumber Pos1 = NexNumber (0, 4, "set.n0"); that's 10% of memory recovered
    subtracting the next 9 NexCheckbox Check = NexCheckbox (2, 13, "set.c0"); is the next 7% recovered
    In both cases I don't need 4 bytes per variable. NextChecbox is only two bits after all. A numeric would suffice to uint16_t.
  • #159 18454555
    ekrzychoooo
    Level 17  
    darlin wrote:
    "set.n0"
    I think in one of the films I said something about the influence of the name length on the RAM occupancy (maybe it was live). On the one hand, long names are cool, but on the other hand, they have to be remembered because the nextion library matches objects by name, not by ID (sucks a bit, but it is).
    darlin wrote:
    NextChecbox is only two bits after all
    why?
  • #160 18454618
    Slawek K.
    Level 35  
    Object names have a huge impact on the size of the memory allocation, so I use at most two characters. Second thing, if the communication with both people on the display is only one way (no callback), do not define the object in Nano, but send data with short Serial.println ending 3x FF transmissions, it will also save you a lot of memory. In the afternoon I'll throw in a sample function if you want.

    Greetings
  • #161 18454850
    darlin
    Level 11  
    Thanks for your guidance. You can see that something else can be done. I will also be happy to see the function.

    As a last resort, you can get rid of the bootloder is some extra 4KB
    but the suggestion of Serial.print and names may solve my problem. I will check and let you know.

    as for NextChecbox 2 bits - no matter - I mixed up something (;
  • #162 18454893
    ekrzychoooo
    Level 17  
    darlin wrote:
    suggestion Serial.print and names maybe will solve my problem.

    You can use the library functions without creating objects, as Sławek wrote.
    Code: C / C++
    Log in, to see the code


    Giving up the bootloader will only save in program memory. Either the application or the bootloader is running.
  • #163 18454973
    Slawek K.
    Level 35  
    Examples of functions below:

    1. Sends a float number to a textbox in Nextion

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


    2. Sends the text to a text field in Nextion

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

    3. Sends an int to the numeric field in Nextion

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


    4. Sends a system command to Nextion
    Code: C / C++
    Log in, to see the code

    Greetings
  • ADVERTISEMENT
  • #164 18457036
    darlin
    Level 11  
    We managed to save some memory with the above methods, but we would like more (;.
    I wonder if the following conversion to uint8_t has the right to work?

    nP1.getValue (uint8_t (& storeData [1] .pos));
    nC1.getValue (uint8_t (& storeData [1] .ch));

    the compiler admits something like this cautiously:
    warning: cast from 'uint8_t * {aka unsigned char *}' to 'uint8_t {aka unsigned char}' loses precision [-fpermissive]

    but it seems to be working.
    Maybe some suggestion in this direction?
    Basically all these 35 values of nextiona controls I have to write to arduino eeprom.
  • #165 18473316
    jacol184
    Level 11  
    Gentlemen, I have been sitting for a long time to run Nextion with ESP32 on Serial2, everything I managed to achieve is one-way communication ESP >> nextion, unfortunately I have no idea how to master nextion
  • #166 18489400
    darlin
    Level 11  
    When I send a command from the level of arduno to nextion using Serial, for example:
    Serial.print ("thsp = 1");
    Serial.print ("\" \ xFF \ xFF \ xFF ");
    All other nextion objects stop being sent, and in the show preview I see something like this:
    ???Bkcmd = 1???page 0??????????????????????????????????????? ???????????????????????????????????? ...
    ???????????????Thsp = 1 "????????????

    When I comment on Serial.print, the others show up:
    ???Bkcmd = 1???page 0???s1.n0???s1.n1???s1.n2???s1.n3???s1.n4???s2.n0??? s2.n1???s2.n2???s2.n30???s2.

    Can't both ways work in parallel?
  • #167 18489537
    ekrzychoooo
    Level 17  
    And what kind of arduino?
  • #169 18489686
    ekrzychoooo
    Level 17  
    Without the code, it will be hard to help.
    A library function that sends looks like this
    Code: C / C++
    Log in, to see the code

    First it clears the input buffer. But that's the way I shoot without the code.
  • #170 18489764
    Anonymous
    Level 1  
  • #171 18489834
    darlin
    Level 11  
    With "thsp = 3" it also doesn't work. Generally my problem concerns all commands sent by serial.
    But I already know what's going on.
    This is an ailment that I described a few posts earlier, and which I still struggle with, not being able to develop anything else in the program.
    It's about the permanent lack of memory for global variables in my nano. .. "Global variables use 1827 bytes (89%) of dynamic memory" ..
    When I freed up my memory a bit, the serial command and nextion object commands started working.

    I came up with a slightly different way of communication. Using the already existing number field. In arduino, I send a numeric field, e.g. value 5.
    I watch in the nextion timer and if the field has this value, I turn it off
    thsp = 3
    thup = 0
    only that it doesn't quite want to work (;

    it only works when I change the value from 5 to another.
  • #172 18489849
    Anonymous
    Level 1  
  • #173 18489865
    darlin
    Level 11  
    .. "leaving 221 bytes for local variables".
    So far, the program without serials works.
  • #174 18527006
    Anonymous
    Level 1  
  • #175 18627751
    kamilzkamil
    Level 7  
    Hello everyone, I got interested in this display thanks to the videos found on YouTube of the Author of the topic, I wanted to do something similar to the episode 18 with the DS18B20 thermometer.
    There is a moment when the numeric keyboard is set under the text field, when I open the debugger after connecting to the arduino, the displayed keyboard flashes and descriptions disappear, e.g. 1,2,3, 4, etc. it should work like that otherwise it gets the code
    1A FF FF FF
    Can anyone help me with this?

    Code: C / C++
    Log in, to see the code
  • #176 18628334
    Anonymous
    Level 1  
  • #177 18628769
    kamilzkamil
    Level 7  
    It's hard to call it a project because it's more of the beginning of fun and testing, I hope it can be downloaded

    I checked this mentioned fragment 10 times, there was actually a mistake :) but correcting didn't change anything the keyboard still starts flashing and code 1A pops up when I select it
  • #178 18632003
    kamilzkamil
    Level 7  
    Okay, different, I wanted to write a code that reads the temperature from several thermometers and have a field to set the value, e.g. for the first thermometer, where if I enter, for example, 23 degrees, the diode next to the arduino will light up after crossing.

    There is something wrong in the rewritten code from the guide, I have the impression that it is about text fields, not numeric ones, but I can't deal with it too much.

    could I count on somebody's help?
  • #179 18655069
    kamilzkamil
    Level 7  
    or maybe someone works on ESP32? I have compile errors all the time and cannot configure Nextion
  • #180 18655294
    Slawek K.
    Level 35  
    In the Nextion.h file, find:
    #include NexUpload.h
    and comment:
    // # include NexUpload.h

    Greetings

Topic summary

A new video tutorial series for NEXTION displays is being developed, focusing on various functionalities and programming techniques. Users discuss the capabilities of NEXTION displays, including sending commands, managing timers, and handling multiple pages. Key topics include using buttons to control outputs, sending data from Arduino to NEXTION, and managing display states across different pages. Users share code snippets for specific tasks, such as updating text fields based on variable values and implementing timers. There are also discussions about troubleshooting issues related to memory usage on Arduino, interfacing with GPS modules, and optimizing communication between Arduino and NEXTION displays.
Summary generated by the language model.
ADVERTISEMENT