Esp8266+Arduino Error

libraries

Code Arduino

#define SSID       "mywifi"
#define PASSWORD   "password"


#include "uartWIFI.h"
#include <SoftwareSerial.h>
WIFI wifi;


void setup()
{
  
  wifi.begin();
  bool b = wifi.Initialize(STA, SSID, PASSWORD);
  if(!b)
  {
    DebugSerial.println("Init error");
  }
  delay(8000);  //make sure the module can have enough time to get an IP address 
  String ipstring  = wifi.showIP();
  DebugSerial.println("My IP address:");
  DebugSerial.println(ipstring);		//show the ip address of module
  
  String wifistring  = wifi.showJAP();
  DebugSerial.println(wifistring);  	//show the name of current wifi access port
  
}
void loop()
{
  

}

Error

In file included from C:\Users\Prarinya\Documents\Arduino\libraries\ESP8266\examples\wifiTest\wifiTest.ino:54:0:

C:\Users\Prarinya\Documents\Arduino\libraries\ESP8266/uartWIFI.h:66:0: warning: "OPEN" redefined [enabled by default]

#define OPEN 1

^

C:\Users\Prarinya\Documents\Arduino\libraries\ESP8266/uartWIFI.h:54:0: note: this is the location of the previous definition

#define OPEN 0

^

C:\Users\Prarinya\Documents\Arduino\libraries\ESP8266/uartWIFI.h:74:0: warning: "SERIAL_TX_BUFFER_SIZE" redefined [enabled by default]

#define SERIAL_TX_BUFFER_SIZE 128

^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224:0,

from sketch\wifiTest.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:46:0: note: this is the location of the previous definition

#define SERIAL_TX_BUFFER_SIZE 64

^

In file included from C:\Users\Prarinya\Documents\Arduino\libraries\ESP8266\examples\wifiTest\wifiTest.ino:54:0:

C:\Users\Prarinya\Documents\Arduino\libraries\ESP8266/uartWIFI.h:75:0: warning: "SERIAL_RX_BUFFER_SIZE" redefined [enabled by default]

#define SERIAL_RX_BUFFER_SIZE 128

^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224:0,

from sketch\wifiTest.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:53:0: note: this is the location of the previous definition

#define SERIAL_RX_BUFFER_SIZE 64

^

As you declare SoftwareSerial I suppose you are using an UNO otherwise you would be using a hardware serial port.

In the .h you include

#include "uartWIFI.h"

There is a line to modify depending on the hardware you use. By default its for a MEGA.

//#define UNO			//uncomment this line when you use it with UNO board
#define MEGA		//uncomment this line when you use it with MEGA board

J-M-L:
As you declare SoftwareSerial I suppose you are using an UNO otherwise you would be using a hardware serial port.

In the .h you include

#include "uartWIFI.h"

There is a line to modify depending on the hardware you use. By default its for a MEGA.

//#define UNO			//uncomment this line when you use it with UNO board

#define MEGA //uncomment this line when you use it with MEGA board

I use mega2560

//#define UNO			//uncomment this line when you use it with UNO board
#define MEGA		//uncomment this line when you use it with MEGA board

Have you tried getting rid of importing software serial? You don't need this. Right? There are many great hardware serial to leverage on your mega.

J-M-L:
Have you tried getting rid of importing software serial? You don't need this. Right? There are many great hardware serial to leverage on your mega.

How?

just remove that line from your code

#include <SoftwareSerial.h>

also make sure you are wired the proper way (that is not what generates the compilation error but is important for the code to work)

ESP8266_TX->RX1(Digital pin of MEGA 19)
ESP8266_RX->TX1(Digital pin of MEGA 18)
ESP8266_CH_PD->3.3V
ESP8266_VCC->3.3V
ESP8266_GND->GND

some ESP are sensitive to sending 5V to RX pin... best would be to have a level adapter in between the 2

J-M-L:
just remove that line from your code

#include <SoftwareSerial.h>

also make sure you are wired the proper way (that is not what generates the compilation error but is important for the code to work)

ESP8266_TX->RX1(Digital pin of MEGA 19)

ESP8266_RX->TX1(Digital pin of MEGA 18)
ESP8266_CH_PD->3.3V
ESP8266_VCC->3.3V
ESP8266_GND->GND




some ESP are sensitive to sending 5V to RX pin... best would be to have a level adapter in between the 2

don't work

I checked the associated .h

and sure enough they have

//The way of encrypstion
[color=red]#define    OPEN          0
[/color]#define    WEP           1
#define    WAP_PSK       2
#define    WAP2_PSK      3
#define    WAP_WAP2_PSK  4

//Communication mode 
#define    TCP     1
#define    tcp     1
#define    UDP     0
#define    udp     0

[color=red]#define    OPEN    1
[/color]#define    CLOSE   0

So indeed they define OPEN twice in that file... so that's poor.

The good news is that they say as well

This library has been discarded. A new library named WeeESP8266 is recommended, which is more easy-to-use for users. WeeESP8266 can be downloaded at GitHub - itead/ITEADLIB_Arduino_WeeESP8266: An easy-to-use Arduino ESP8266 library besed on AT firmware..

So I suggest you get rid of the old library from your arduino library folder and install their new stuff