Start a new topic

backspace key in KEYPAD





i m making a screen that will allow me to add a contact to the SD card then it will display all the contacts on another page "Contacts" First of all a tiny problem is that backspace key "Button b36"....As you can see that there are 2 text boxes.. but the backspace key only works for t0... i want to do something like this 1)when t0 is active backspace key used to remove its item

2) when t1 is active same backspace key is used for the removal of its items

What is your strategy to deal with this issue?


{ t0.txt=t0.txt-1}



something like this ...but i don't know the exact commands which i can use in nextion editor.

Two things to read

  "Nextion TTL Serial"

  "Nextion Instruction Set"

This forms the basis of what you can use

There is no such t0=="active", that construct you would have to build.

Format of if else








condition must be a simplex evaluation, complex not allowed

what is being compared in evaluation must exist

i have read the NEXTION instruction set 
but couldn't find the suitable condition to solve this problem

i have another problem
in arduino code how to read these 2 get commands in separate strings  
means string 1 got t2,txt and string 2 got t1.txt
really confused here..


As far as reading the Nextion Instruction Set

   along with the information from Nextion TTL Serial

This forms the basis of what you can use.

When you can not find a suitable condition to solve the problem

  - read them again, and again if necessary

  - as stated, they form the basis of what you can use

       all is built out of just these commands

       there are no others, except what you form using them.

  - you must assemble the order of such to achieve your desired goal.

Perhaps redefine the steps needed to accomplish your desired goal

   paying attention to what you will need to achieve the goal

   - the Nextion and your MCU will only do as instructed by you

   - you will need them to work in tandem together

The IteadLib Arduino Nextion Library method 

   to read .txt attribute

        use method .getText() of component variable or

        use the function recvRetString() in nexHardware.

   study the examples in the examples folder

   study the code that makes up the library.

Confusion is from a plan not well defined

    work out your super detailed plan, then just follow it.

#include "Nextion.h"



void b0PopCallback(void *ptr);



NexText t0_1 = NexText(1, 16, "t0");



NexButton b0_1 = NexButton(1, 2, "b0");




char buffer[4] = {0};



 * Register object t0, b0, b1, to the touch event list.


NexTouch *nex_listen_list[] =






void b0_1PopCallback(void *ptr)



    memset(buffer, 0, sizeof(buffer));

    t0_1.getText(buffer, sizeof(buffer));






void setup(void)


    /* Set the baudrate which is for debugging and communication with Nextion screen. */


    /* Register the pop event callback function of the current button0 component. */



    /* Register the pop event callback function of the current button1 component. */

    dbSerialPrintln("setup done");



void loop(void)



     * When a pop or push event occured every time,

     * the corresponding component[right page id and component id] in touch event list will be asked.




i have connected arduino uno with nextion 
why this recvRetString() is empty 


bushra, timing issue in your code.

#include "Nextion.h" 

//Declare a button object [page id:0,component id:1, component name: "b0"].

NexProgressBar j0 = NexProgressBar(0, 10, "j0");  // this show a valve 

NexNumber n0 = NexNumber(0, 12, "n0"); //% // this is a  number on you screen

NexText t5 = NexText(0, 4, "t5");   // that is showing as text 

NexButton b2 = NexButton(0, 8, "b2");// this are like a switch ( button of hod function )

NexDSButton bt0 = NexDSButton(0, 9, "bt0"); this are button


NexTouch *nex_listen_list[] =








void setup() {


  // put your setup code here, to run once:



  b2.attachPop(b2PopCallback, &b2);

  bt0.attachPop(bt0PopCallback, &bt0);

  dbSerialPrintln("setup done");


void loop() {





void b1PopCallback(void *ptr)


    analogWrite(current_lim, 255);


void b2PopCallback(void *ptr)


    analogWrite(current_lim, 0);


void bt0PopCallback(void *ptr)


    uint32_t dual_state;

    //NexDSButton *btn = (NexDSButton *)ptr;




    //memset(buffer, 0, sizeof(buffer));

    /* Get the state value of dual state button component . */


    //Serial.print("number of button pushes: ");Serial.println(dual_stat);



        digitalWrite(led, HIGH);

        s = HIGH;

        //Serial.print("number of button pushes: 1 ");




        digitalWrite(led, LOW);

        s = LOW;

        //Serial.print("number of button pushes: 0 ");



void Print()


    uint32_t number = 0;


    j0.getValue(&number);  // if you read a number from nextion 

    j0.setValue(i);              // if you somethin sed a number to change

    n0.setValue(i);            // value can be 0 to 100 and not else!



if you want to hide some item:

sendCommand("vis r2,0");

and if you want show 

sendCommand("vis r2,1");

ah and here a convert from string to char

   numS_V = I_vol /10;

   String numTXT= String(numS_V,1);//Will show 1 decimal places 

   char buf[10] = {0};



Login or Signup to post a comment