Hello!
I have a Nextion display from itead studios. I have made a simple program from the Nextion Editor, and uploaded it to the Nextion display using an SD card. (It works) The Nextion program is simply a screen with a few different buttons on it. I have written some corresponding Arduino code to go with the Nextion program, using the Nextion library.
However, my code is not working! The Serial Monitor shows "Setup Done" successfully, but when I press the buttons on the display, there is no message in the Serial Monitor! What did I do wrong?
Any help would be super!
-SQ
#include <doxygen.h>
#include <NexButton.h>
#include <NexCheckbox.h>
#include <NexConfig.h>
#include <NexCrop.h>
#include <NexDualStateButton.h>
#include <NexGauge.h>
#include <NexGpio.h>
#include <NexHardware.h>
#include <NexHotspot.h>
#include <NexNumber.h>
#include <NexObject.h>
#include <NexPage.h>
#include <NexPicture.h>
#include <NexProgressBar.h>
#include <NexRadio.h>
#include <NexRtc.h>
#include <NexScrolltext.h>
#include <NexSlider.h>
#include <NexText.h>
#include <NexTimer.h>
#include <Nextion.h>
#include <NexTouch.h>
#include <NexUpload.h>
#include <NexVariable.h>
#include <NexWaveform.h>
NexButton buttonPhone = NexButton(0, 1, "buttonPhone");
NexButton buttonRadio = NexButton(0, 2, "buttonRadio");
NexButton buttonMessages = NexButton(0, 3, "buttonMessages");
NexButton buttonSettings = NexButton(0, 4, "buttonSettings");
NexTouch *nex_listen_list[] =
{
&buttonPhone,
&buttonRadio,
&buttonMessages,
&buttonSettings,
NULL
};
void buttonPhonePopCallback(void *ptr) {
dbSerialPrintln("buttonPhonePopCallback");
}
void buttonRadioPopCallback(void *ptr) {
dbSerialPrintln("buttonRadioPopCallback");
}
void buttonMessagesPopCallback(void *ptr) {
dbSerialPrintln("buttonMessagesPopCallback");
}
void buttonSettingsPopCallback(void *ptr) {
dbSerialPrintln("buttonSettingsPopCallback");
}
void setup() {
nexInit();
Serial.begin(115200);
nexSerial.begin(9600);
buttonPhone.attachPop(buttonPhonePopCallback);
buttonRadio.attachPop(buttonRadioPopCallback);
buttonMessages.attachPop(buttonMessagesPopCallback);
buttonSettings.attachPop(buttonSettingsPopCallback);
dbSerialPrintln("Setup Done");
}
void loop() {
nexLoop(nex_listen_list);
}