Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

GetValue strange behavior #40

Open
llist opened this issue Jan 27, 2018 · 6 comments
Open

GetValue strange behavior #40

llist opened this issue Jan 27, 2018 · 6 comments

Comments

@llist
Copy link

llist commented Jan 27, 2018

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

@llist
Copy link
Author

llist commented Jan 28, 2018

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

@Snake675
Copy link

Hi
This solution does not work for me. Still getting zeros all the time on any "getValue()".

@vandijkict
Copy link

I have the same problem, my result for getValue() is always 0
The same problem with dual state buttons or radiobuttons

@llist
Copy link
Author

llist commented Feb 19, 2020

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

@vandijkict
Copy link

There is nothing wrong with communication, because I can read the callback events and read and change textboxes

@llist
Copy link
Author

llist commented Feb 20, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants