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

numeric variable value not being fetched #33

Open
rangathedon opened this issue Aug 15, 2017 · 9 comments
Open

numeric variable value not being fetched #33

rangathedon opened this issue Aug 15, 2017 · 9 comments

Comments

@rangathedon
Copy link

numeric variable values are fetched fine on arduino nano but same code does not work on mega; any ideas? any changes needed specifically for mega?

@DanNixon
Copy link
Owner

Does anything work on the Mega?

There is nothing platform specific about the protocol.

@rangathedon
Copy link
Author

all other things like updating stuff on the display work; only problem is fetching variable values; I try to set the value of a variable on nextion when a button is clicked and in the loop in arduino code I try to get value of the variable; this works very well on the NANO and UNO but on a MEGA it isn't working;

@DanNixon
Copy link
Owner

Does anything that requires receiving work?
Is the code identical on both boards?

@rangathedon
Copy link
Author

rangathedon commented Aug 16, 2017 via email

@rangathedon
Copy link
Author

rangathedon commented Aug 16, 2017 via email

@rangathedon
Copy link
Author

tried getting other values; none of the values are being fetched;
m_serialPort.readBytes(temp, sizeof(temp)) is returning 0 in call bool Nextion::receiveNumber(uint32_t *number)
that gave a clue; I am using software serial and certain input pins do not support interrupts on software serial on the mega; looks like thats the issue with not being able to receive; I am able to get the values now after switching to different inputs which support it;

@llist
Copy link

llist commented Jan 28, 2018

you solve your problem using which port on Mega ( RX3/TX3 , RX/TX2 or RX/TX1 ) ?

@llist
Copy link

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

For Mega do not use RX1/TX1 ,RX2/TX2 and RX3/TX3 !!

@llist
Copy link

llist commented Jan 28, 2018

Thank you a lot Dan for your great Library !!

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