Hi! I am trying to use a nextion display with an UNO, and I came across a problem, that I don't understand. I want to simply read the value of the slider, whenever I "release" it. Here is my code:
#include "Nextion.h"
#undef DEBUG_SERIAL_ENABLE
NexSlider h0 = NexSlider(0, 3, "h0");
NexTouch *nex_listen_list[] =
{
&h0,
NULL
};
void h0PopCallback(void *ptr)
{
uint32_t retval = 0;
bool succes = h0.getValue(&retval);
if(succes){
Serial.println(retval);
}else{
Serial.println("Could not read slider!");
}
}
void setup(void)
{
nexInit();
h0.attachPop(h0PopCallback, &h0);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}
The code can be compiled, but no matter how hard I tryed, it always sas:"Could not read slider!"
The grounds of the display and the UNO are connected, and the communication is working.(I have tryed a simple button, and that worked!)
Can anybody help? Thanks!