NeoNextion icon indicating copy to clipboard operation
NeoNextion copied to clipboard

numeric variable value not being fetched

Open rangathedon opened this issue 7 years ago • 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?

rangathedon avatar Aug 15 '17 19:08 rangathedon

Does anything work on the Mega?

There is nothing platform specific about the protocol.

DanNixon avatar Aug 16 '17 09:08 DanNixon

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;

rangathedon avatar Aug 16 '17 10:08 rangathedon

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

DanNixon avatar Aug 16 '17 11:08 DanNixon

Code is same on both boards;

On Wed, Aug 16, 2017 at 4:43 PM, Dan Nixon [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DanNixon/NeoNextion/issues/33#issuecomment-322738751, or mute the thread https://github.com/notifications/unsubscribe-auth/AWd8IYPGr__aZlJWx8GTnKtxTGDSq2Wjks5sYs7AgaJpZM4O4BHe .

rangathedon avatar Aug 16 '17 16:08 rangathedon

I dont really receive anything else so not sure on that

On Wed, Aug 16, 2017 at 10:24 PM, techniche [email protected] wrote:

Code is same on both boards;

On Wed, Aug 16, 2017 at 4:43 PM, Dan Nixon [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DanNixon/NeoNextion/issues/33#issuecomment-322738751, or mute the thread https://github.com/notifications/unsubscribe-auth/AWd8IYPGr__aZlJWx8GTnKtxTGDSq2Wjks5sYs7AgaJpZM4O4BHe .

rangathedon avatar Aug 16 '17 16:08 rangathedon

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;

rangathedon avatar Aug 17 '17 11:08 rangathedon

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

llist avatar Jan 28 '18 07:01 llist

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 avatar Jan 28 '18 18:01 llist

Thank you a lot Dan for your great Library !!

llist avatar Jan 28 '18 18:01 llist