nextion
nextion copied to clipboard
Need help with getComponentText and getComponentValue
Please help me figure it out. The display has n0=0 and t0=text. I use `#include <SoftwareSerial.h> #include <Nextion.h> SoftwareSerial nextion(17, 16); Nextion myNextion(nextion, 9600);
int recc; String id, mess;
void setup() { Serial.begin(9600); myNextion.init();
} void loop() {
mess = myNextion.getComponentText("t0"); Serial.print("mess: "); Serial.println(mess);
delay(1000);
recc = myNextion.getComponentValue("n0"); Serial.print("recc: "); Serial.println(recc);
delay(1000); }`
And I get mess: 1a recc: -1 Tell me what I'm doing wrong. I want to get at least a text. Thank you!
There should be no delay()s in loop(). Use the examples to get started (ReceiveMessages.ino).