NeoNextion
NeoNextion copied to clipboard
numeric variable value not being fetched
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?
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 .
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 .
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;
you solve your problem using which port on Mega ( RX3/TX3 , RX/TX2 or RX/TX1 ) ?
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 !!
Thank you a lot Dan for your great Library !!