The Nextion IO are digital 0,1 only for input modes.
The Nextion is also integer based (no floating point)
However, using your Mega and the IteadLib Arduino Nextion Library.
(please refer to the Nextion FAQs, link to IteadLib is there)
NexNumber sensorNumber NexNumber(0,1,"page0.n0");
// one your value from HC-SR04 is in sensorValue;
Hi Patrick thanks for your answer, but i have another problem that´s why i can probe your solution, when i compile the program in arduino i have this error : expected initializer before 'NexNumber', i tested wiht others librieries and they give me another error; NexNumber does not name a type, do you have any idea?
Two things come to mind quickly
1) the #include "Nextion.h" for the IteadLibrary will need to be at the top of the code file
- NexInit() will need to be in the Setup() function
- NexLoop() will need to be in the Loop() function
2) installing many libraries? in itself can create conflict
- the compiler will probably grab the first it comes across - maybe not IteadLib.
Hi Patrick thanks for you answer, i had many libraries as you said, i already solvet, but i still have an error displaying the sensorValue on the screen, this is my funtion on the sketch
long duration, inches, cm;
duration = pulseIn(pingIn,HIGH,30000);
cm = duration / 29 / 2;
memset (buffer, 0, sizeof(buffer));
itoa(cm, buffer, 10);
i have an error and i can´t see it.
thanks for your time and patience
Please review NexNumber.h and NexNumber.cpp
- I have my doubts that setValue uses a string as a parameter