NeoNextion
NeoNextion copied to clipboard
GetValue strange behavior
Hi,
I have a Numeric Variable I can SET the variable but when i read the Value the result is 0 ?? Same for a Slider , I can change color and value but when I use slider.getValue() the result is 0 !!
Every setValue => OK Every getValue => not OK return value are 0 An Idea ?
Arduino Mega 2560 and screen Nextion NX4832K035_011 or NX4832T035_011
this is the solution
For UNO #define UNO_RXPIN 10 #define UNO_TXPIN 11 SoftwareSerial nextionSerial(UNO_RXPIN, UNO_TXPIN); // RX, TX
For MEGA #define MEGA_RX_PIN 53 #define MEGA_TX_PIN 51
SoftwareSerial nextionSerial(MEGA_RX_PIN, MEGA_TX_PIN); // RX, TX
Hi This solution does not work for me. Still getting zeros all the time on any "getValue()".
I have the same problem, my result for getValue() is always 0 The same problem with dual state buttons or radiobuttons
Hi, If you can change the value that means your TX_PIN is the good one . GetValue = Rx_PIN = read pin if you cannot read there are 2 assumptions : Case 1 : For RX_PIN choose the good PIN number in your Arduino board ( See First post ) Case 2: under your screen through Nextion Editor change/verify if your variable attribut was set to : VSCOPE = global. Reason : ex: Screen 1 contains the Variable1 : you can read it only if screen1 is in front ( displayed) If you are set this variable in global mode you can read even if the screen is not displayed.
Hoping that can help you
There is nothing wrong with communication, because I can read the callback events and read and change textboxes
Hi Another possibility.
Into your source code add the screen name into the variable declaration: see ECRANS.onoff_pompBois
//---------------------------------------- #define ECRAN_1 1 ..... Nextion nex(nextionSerial); NextionPage ecran1(nex, ECRAN_1, 0, "ECRANS");
NextionVariableNumeric MyVar(nex, ECRAN_1, 6, "ECRANS.onoff_pompBois");
try this
Good luck