Start a new topic

save data txt from nextion to Arduino Mega2560

Hi, how I can save data txt from textbox on nextion to arduino mega2560, (e.g) I write using keyboard to fill t0.txt, and then I want to save data t0.txt to arduino when I push b1(button). THX

- on Nextion side at button press just send the data
- on MEGA side just receive and save the send data


okey, but could you tell me or show me the example code to detect button press event, get the text from t0.txt on nextion. I've been looking for the example code, I found fish tank tutorial 

void b0PopCallback(void *ptr)


    NexButton *btn = (NexButton *)ptr;

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

    btn->getText(buffer, sizeof(buffer));

    if (strcmp(buffer,"ON"))


        digitalWrite(9, HIGH);

        strcpy(buffer, "ON");




        digitalWrite(9, LOW);

        strcpy(buffer, "OFF");





but I still don't understand

Nextion commands can be found in the Nextion Instruction Set located here


Please find the link for the IteadLib Arduino Nextion library
Within this library are several basic examples to follow and learn some basics.

The final programming should be done by yourself ... sorry
Login or Signup to post a comment