Error

Hello , i have a problem with my code , and the problem is big error. I have an arduino uno.

Arduino: 1.6.7 (Windows 10), Vývojová deska: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

WARNING: Category '' in library ArduinoUnit is not valid. Setting to 'Uncategorized'
C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp: In function 'bool recvRetNumber(uint32_t*, uint32_t)':

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:67:31: warning: left shift count >= width of type [enabled by default]

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

                               ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:67:49: warning: left shift count >= width of type [enabled by default]

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

                                                 ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:75:40: error: 'dbSerialPrint' was not declared in this scope

         dbSerialPrint("recvRetNumber :");

                                        ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:76:32: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln(*number);

                                ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:80:44: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln("recvRetNumber err");

                                            ^

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:150:35: error: 'dbSerialPrint' was not declared in this scope

     dbSerialPrint("recvRetString[");

                                   ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:154:24: error: 'dbSerialPrintln' was not declared in this scope

     dbSerialPrintln("]");

                        ^

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:209:52: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln("recvRetCommandFinished ok");

                                                    ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:213:53: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln("recvRetCommandFinished err");

                                                     ^

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:225:23: error: 'dbSerialBegin' was not declared in this scope

     dbSerialBegin(9600);

                       ^

exit status 1
Chyba kompilace.

  Tento výpis by měl více informací s
  "Zobrazit více informací během kompilace"
  povoleno v Soubor > Vlastnosti

Could you help me solve this issue? :smiley:

oh sorry i change an error

#include "Nextion.h"
#include "Arduino.h"


void okPopCallback(void *ptr);
void zamkPopCallback(void *ptr);

NexText heslo = NexText(1, 1, "t0");
NexText vp = NexText(1, 17, "t1");
NexButton ok = NexButton(1, 12, "enter");
NexButton zamk = NexButton(3, 5, "b1");

char buffer[100] = {0};

NexTouch *nex_listen_list[] = 
{
    &ok,
    NULL
};

//kontrola správnosti hesla
void okPopCallback(void *ptr)
{
 
    memset(buffer, 0, sizeof(buffer));
    heslo.getText(buffer ,sizeof(buffer));
    if (strcmp(buffer,"1235"))
    {
      digitalWrite(4, HIGH);
      strcpy(buffer, "OK");
    }else{
      digitalWrite(4, LOW);
      strcpy(buffer, "NE"); 
      }
     vp.setText(buffer); 
}


void setup(void) {
  // put your setup code here, to run once:
  pinMode(4, OUTPUT);
  nexInit();
  ok.attachPop(okPopCallback);
  zamk.attachPop(zamkPopCallback);
}

void loop(void) {
  // put your main code here, to run repeatedly:
 nexLoop(nex_listen_list);
}

And this i have in NexConfig.h

/**
 * @file NexConfig.h
 *
 * Options for user can be found here. 
 *
 * @author  Wu Pengfei (email:<pengfei.wu@itead.cc>)
 * @date    2015/8/13
 * @copyright 
 * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */
#ifndef __NEXCONFIG_H__
#define __NEXCONFIG_H__

/**
 * @addtogroup Configuration 
 * @{ 
 */

/** 
 * Define DEBUG_SERIAL_ENABLE to enable debug serial. 
 * Comment it to disable debug serial. 
 */
#define DEBUG_SERIAL_ENABLE

/**
 * Define dbSerial for the output of debug messages. 
 */
#define dbSerial Serial

/**
 * Define nexSerial for communicate with Nextion touch panel. 
 */
#define nexSerial Serial3


#ifdef DEBUG_SERIAL_ENABLE
#define dbSerial2Print(a)    dbSerial2.print(a)
#define dbSerial2Println(a)  dbSerial2.println(a)
#define dbSerial2Begin(a)    dbSerial2.begin(a)
#else
#define dbSerial2Print(a)    do{}while(0)
#define dbSerial2Println(a)  do{}while(0)
#define dbSerial2Begin(a)    do{}while(0)
#endif

/**
 * @}
 */

#endif /* #ifndef __NEXCONFIG_H__ */
*number = (temp[4] << 24)

Sixteen bit int arithmetic doesn't allow a left shift of 24 bits.

Ok, but this is from nextion library , so how can i fix it ?

You have the source of the library - add some "(uint32_t)" casts.

yeah and what? i still dont underestand what do you mean ?

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

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

now it have this problem

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:75:40: error: 'dbSerialPrint' was not declared in this scope

         dbSerialPrint("recvRetNumber :");

                                        ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:76:32: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln(*number);

                                ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:80:44: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln("recvRetNumber err");

                                            ^

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:150:35: error: 'dbSerialPrint' was not declared in this scope

     dbSerialPrint("recvRetString[");

                                   ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:154:24: error: 'dbSerialPrintln' was not declared in this scope

     dbSerialPrintln("]");

                        ^

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:209:52: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln("recvRetCommandFinished ok");

                                                    ^

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:213:53: error: 'dbSerialPrintln' was not declared in this scope

         dbSerialPrintln("recvRetCommandFinished err");

                                                     ^

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

C:\Users\mikul\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion-0.7.0\NexHardware.cpp:225:23: error: 'dbSerialBegin' was not declared in this scope

     dbSerialBegin(9600);

                       ^

exit status 1

The compiler has told you exactly what the problem is.

But the problem is that , that i have declared debug serial disabled.

I solved this problem SEE ON YOUTUBE

@operrr

WELL DONE - That is a very nice video addressing a few fine-tuning issues with Arduino Due and Nextion.