Start a new topic

Error in compiling arduino nextion example

my arduino is nano and i have this error after compile nextion example

How can i solve it?

Thanks



In file included from C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.h:18:0,

 

                 from C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:15:

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'bool recvRetNumber(uint32_t*, uint32_t)':

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:55:5: note: in expansion of macro 'nexSerial'

 

     nexSerial.setTimeout(timeout);

 

     ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:67:31: warning: left shift count >= width of type

 

         *number = (temp[4] << 24) | (temp[3] << 16) | (temp[2] << 8) | (temp[1]);

 

                               ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:67:49: warning: left shift count >= width of type

 

         *number = (temp[4] << 24) | (temp[3] << 16) | (temp[2] << 8) | (temp[1]);

 

                                                 ^

 

In file included from C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.h:18:0,

 

                 from C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:15:

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'uint16_t recvRetString(char*, uint16_t, uint32_t)':

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:114:16: note: in expansion of macro 'nexSerial'

 

         while (nexSerial.available())

 

                ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'void sendCommand(const char*)':

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:166:12: note: in expansion of macro 'nexSerial'

 

     while (nexSerial.available())

 

            ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:171:5: note: in expansion of macro 'nexSerial'

 

     nexSerial.print(cmd);

 

     ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'bool recvRetCommandFinished(uint32_t)':

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:192:5: note: in expansion of macro 'nexSerial'

 

     nexSerial.setTimeout(timeout);

 

     ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'bool nexInit()':

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:226:5: note: in expansion of macro 'nexSerial'

 

     nexSerial.begin(9600);

 

     ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'void nexLoop(NexTouch**)':

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

 

 #define nexSerial Serial2

 

                   ^

 

C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:242:12: note: in expansion of macro 'nexSerial'

 

     while (nexSerial.available() > 0)

 

            ^

 

Using library ITEADLIB_Arduino_Nextion-0.7.0 in folder: C:\Users\Voyager\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0 (legacy)

exit status 1

Error compiling for board Arduino Nano.



as far as I see, 2 possibilities out

    - either change to an Arduino model the code was written for
    - or change the code that it fit your Nano characteristics

 

Gerry thanks for quick reply.

when i change the board to mega2560 in IDE there is no error.

How can i fit nextion library examples for Nano board ? 


Login or Signup to post a comment