Start a new topic

Nextion Keyboard SEND key

Hi Guys,


I just made my keyboard on nextion and what I write in the keyboard shows up in t10.txt, I now need to display what I write in another page I tried creating a variable and copying from t10.txt to this variable with command cov va0.val,t10.txt,0  but it does not work, what I write on keyboard does not display on the other page with the same t10.txt which I set as global variable.


Any thoughts?

Thanks

Filipe


With Arduino, it is easier to attach a small microSD card, or a flash chip you have full rights over.  You then have the ability to save the data during a powered off state.


I am also looking at power as part of my project and if you know that your environment isn't going to use the device overnight (10 hours a day usage, 14 hours no usage) then you have an opportunity to kill power hungry items when not in use.

The Nextion can be placed into sleep mode, and allowed to be waken via touch or serial.  Serial means it will wake when your Arduino sends a message to it =)   Sleep can be induced automatically after 3 seconds to 65535 seconds (18h12m15s) if there is no touch / if there has been no serial data, or immediate on demand issuing the sleep command.  On my Edison, I power off my wifi/bt radio until it is time to wake in the morning.  Weekends is time for it to sleep (depending on your application).  An RTC module for Arduino and you have similar abilities.


Patrick

Hello Patrick Thank you so much for your message indeed I am using the nextion screen with an Arduino nano and mostly the Nano is just to calculate some stuff and presented in graphics. This part is working pretty well now I am working on the touchscreen part. My problem is that the Arduino and the touch screen will have the same power supply so when did Arduino is down the screen is also down and vice versa, I think this means I cannot have a variable which contains and info that was previously Android using the keyboard in the nextion screen, am I right? I think I would need some sort of memory that would stock the variables I need once reboot of both devices. Let me know your thoughts Filipe

So all the variables changed in the HMI will disappear on reboot.  So the question becomes is the Nextion display connected to another mcu.  if it isn't, then at the moment (future Enhanced/Intelligent versions may change things) you are stuck with default values you place in your HMI. 


However, if your Nextion Display is connected to an Arduino etc (I use the Intel Edison), then you can retrieve values, and restore them.  To retrieve before shutdown, you would send get va0.txt (your t10.txt was transferred there) and the Nextion should respond with a 0X70 0X61 0X62 0X63 0XFF 0XFF 0XFF   where the 0x61 0x62 0x63 ("abc") are the byte values of the letters in va0.  The 0x70 in the front means string data follows, and the 0xFF 0xFF 0xFF means end of data.   Then on startup, you can restore variables by issuing commands like va0.txt="FRANCE" or t10.txt="FRANCE" etc.


If you look through the Nextion Instruction Set, you will find some useful codes to know if the nextion is starting up, etc.  You could also put a button on your screen that "says" Shutdown, and in the touch press event preform your saving, then in the touch release, your commands for shutdown.  Likewise a button that "says" Login can easily trigger your reload by sending the component ID, and when you see it, have your function set all the variables you wanted.


Hope this is a bit helpful, lots to digest.

Hi


Yep, thanks got it and it is working pretty well :)


Maybe you can help me with this other question, with my keyboard I write for exemple FRANCE to t10.txt and it is perfect on page 0 and page 1, now when I reboot the nextion screen the text that I had on t10.txt will go away, it will not be saved for future use. Is there a way to set a variable to always be the same untill I write another one with the keykboard again?


Thanks

Filipe

cov va0.val,t10.txt,0 takes the numeric content of va0 and writes the number as a string t10.txt


try making va0 variable with

vscope global, and

sta string

txt-maxl 50

don't forget to set your max length as needed upto 255.

to copy t10.txt into va0 is

va0.txt=t10.txt


On your other page, I assume you are trying to put va0 into another variable say t2

in the page initialization, t2.txt=va0.txt


Let me know

Patrick




Login or Signup to post a comment