• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Nextion HMI with ESP8266 and ESP32

Q&A Forum › Nextion HMI with ESP8266 and ESP32
0 Vote Up Vote Down
Dattatraya Apte asked 5 years ago
2 Answers
0 Vote Up Vote Down
Dattatraya Apte answered 5 years ago

I tried The following sketch with ESP 8266 (Node – MCU-12E) and it worked fine.

#include “Nextion.h”

const int led = 4;//RED LED aatched to D2 pin (GPIO4)

//Declare your Nextion objects , pageid, component id., component name

NexButton b0 = NexButton(0,2,”b0″);
NexButton b1 = NexButton(0,3,”b1″);
NexText t0 = NexText(0,4,”t0″);

//Register a button object to the touch event list

NexTouch *nex_listen_list[] = {
&b0,
&b1,
NULL
};

//Button b0 component popcallback function
// When ON button is Released the LED turns ON and the state text changes

void b0PopCallback(void *ptr){
t0.setText (“State:ON”);
digitalWrite(led,HIGH);
}

//Button b1 component popcallback function
// When OFF button is released the LED turns OFF and the state text changes

void b1PopCallback(void *ptr){
t0.setText (“State:OFF”);
digitalWrite(led,LOW);
}
void setup(void) {
Serial.begin(9600);
nexInit();
//Register the pop event callback function of the components

b0.attachPop(b0PopCallback,&b0);
b1.attachPop(b1PopCallback,&b1);

pinMode(led,OUTPUT);
digitalWrite(led,LOW);

}

void loop() {
nexLoop(nex_listen_list);

}

=======================================================================================
Then I wanted to same sketch with ESP32 but it was giving compilation error so I did the modifications using Git GUI and Git Bash and explained in git hub. and it worked with ESP 32. but now it is not working with Node MCU.

So I removed the repository of ESP32 as that was install as explained above. But with this now it is giving compilation error for both the boards.
I want to use Nextion HMI with both ESP8266 and ESP 32. Please guide me.

The error message which I am getting now is as below.

=====================================================================================

Arduino: 1.8.12 (Windows 10), Board: “DOIT ESP32 DEVKIT V1, 80MHz, 921600, None”

C:\Users\APTE\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-master\NexUpload.cpp:17:28: fatal error: SoftwareSerial.h: No such file or directory

Multiple libraries were found for “SD.h”
compilation terminated.

Used: C:\Users\APTE\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\SD
Not used: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
Error compiling for board DOIT ESP32 DEVKIT V1.

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi.
I answered your question here: https://rntlab.com/question/nextion-with-esp8266/
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.