bborncr / nextion

A simple Nextion HMI library for Arduino
GNU General Public License v3.0
127 stars 66 forks source link

Need help with getComponentText and getComponentValue #41

Open talexts opened 5 years ago

talexts commented 5 years ago

Please help me figure it out. The display has n0=0 and t0=text. I use `#include

include

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!

bborncr commented 5 years ago

There should be no delay()s in loop(). Use the examples to get started (ReceiveMessages.ino).