DanNixon/NeoNextion

numeric variable value not being fetched

rangathedon opened this issue · 9 comments

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?

Does anything work on the Mega?

There is nothing platform specific about the protocol.

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;

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

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 commented

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

llist commented

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 commented

Thank you a lot Dan for your great Library !!