Giter Site home page Giter Site logo

iteadlib_arduino_weeesp8266's Introduction

@mainpage

WeeESP8266

An ESP8266 library for Arduino providing an easy-to-use way to manipulate ESP8266.

Source

Source can be download at https://github.com/itead/ITEADLIB_Arduino_WeeESP8266.

You can clone it by:

git clone https://github.com/itead/ITEADLIB_Arduino_WeeESP8266.git

Documentation

Online API documentation can be reached at http://docs.iteadstudio.com/ITEADLIB_Arduino_WeeESP8266/index.html.

Offline API documentation can be found under directory doc.

How to get started

On the home page of API documentation, the tabs of Examples, Classes and Modules will be useful for Arduino lovers.

API List

bool 	kick (void) : Verify ESP8266 whether live or not.
 
bool 	restart (void) : Restart ESP8266 by "AT+RST".
 
String 	getVersion (void) : Get the version of AT Command Set.
 
bool 	setOprToStation (void) : Set operation mode to staion.
 
bool 	setOprToSoftAP (void) : Set operation mode to softap.
 
bool 	setOprToStationSoftAP (void) : Set operation mode to station + softap.
 
String 	getAPList (void) : Search available AP list and return it.
 
bool 	joinAP (String ssid, String pwd) : Join in AP. 
 
bool 	leaveAP (void) : Leave AP joined before. 
 
bool 	setSoftAPParam (String ssid, String pwd, uint8_t chl=7, uint8_t ecn=4) : Set SoftAP parameters. 
 
String 	getJoinedDeviceIP (void) : Get the IP list of devices connected to SoftAP. 
 
String 	getIPStatus (void) : Get the current status of connection(UDP and TCP). 
 
String 	getLocalIP (void) : Get the IP address of ESP8266. 
 
bool 	enableMUX (void) : Enable IP MUX(multiple connection mode). 
 
bool 	disableMUX (void) : Disable IP MUX(single connection mode). 
 
bool 	createTCP (String addr, uint32_t port) : Create TCP connection in single mode. 
 
bool 	releaseTCP (void) : Release TCP connection in single mode. 
 
bool 	registerUDP (String addr, uint32_t port) : Register UDP port number in single mode. 
 
bool 	unregisterUDP (void) : Unregister UDP port number in single mode. 
 
bool 	createTCP (uint8_t mux_id, String addr, uint32_t port) : Create TCP connection in multiple mode. 
 
bool 	releaseTCP (uint8_t mux_id) : Release TCP connection in multiple mode. 
 
bool 	registerUDP (uint8_t mux_id, String addr, uint32_t port) : Register UDP port number in multiple mode. 
 
bool 	unregisterUDP (uint8_t mux_id) : Unregister UDP port number in multiple mode. 
 
bool 	setTCPServerTimeout (uint32_t timeout=180) : Set the timeout of TCP Server. 

bool 	startServer (uint32_t port=333) : Start Server(Only in multiple mode).

bool 	stopServer (void) : Stop Server(Only in multiple mode).

bool 	startTCPServer (uint32_t port=333) : Start TCP Server(Only in multiple mode). 
 
bool 	stopTCPServer (void) : Stop TCP Server(Only in multiple mode). 
 
bool 	send (const uint8_t *buffer, uint32_t len) : Send data based on TCP or UDP builded already in single mode. 
 
bool 	send (uint8_t mux_id, const uint8_t *buffer, uint32_t len) : Send data based on one of TCP or UDP builded already in multiple mode. 
 
uint32_t 	recv (uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000) : Receive data from TCP or UDP builded already in single mode. 
 
uint32_t 	recv (uint8_t mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000) : Receive data from one of TCP or UDP builded already in multiple mode. 
 
uint32_t 	recv (uint8_t *coming_mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000) : Receive data from all of TCP or UDP builded already in multiple mode. 

Mainboard Requires

  • RAM: not less than 2KBytes
  • Serial: one serial (HardwareSerial or SoftwareSerial) at least

Suppported Mainboards

Using SoftwareSerial

If you want to use SoftwareSerial to communicate with ESP8266, you need to modify the line in file ESP8266.h:

//#define ESP8266_USE_SOFTWARE_SERIAL

After modification, it should be:

#define ESP8266_USE_SOFTWARE_SERIAL

Hardware Connection

WeeESP8266 library only needs an uart for hardware connection. All communications are done via uart. In each example, you must specify the uart used by mainboard to communicate with ESP8266 flashed AT firmware.

MEGA and WBoard Pro

For MEGA and WBoard Pro, Serial1 will be used if you create an object (named wifi) of class ESP8266 in your code like this:

#include "ESP8266.h"
ESP8266 wifi(Serial1);

The connection should be like these:

ESP8266_TX->RX1(D19)
ESP8266_RX->TX1(D18)
ESP8266_CH_PD->3.3V
ESP8266_VCC->3.3V
ESP8266_GND->GND

UNO

To use SoftwareSerial, mySerial will be used if you create an object (named wifi) of class ESP8266 in your code like this:

#include "ESP8266.h"
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 2); /* RX:D3, TX:D2 */
ESP8266 wifi(mySerial);

The connection should be like these:

ESP8266_TX->RX(D3)
ESP8266_RX->TX(D2)
ESP8266_CH_PD->3.3V
ESP8266_VCC->3.3V
ESP8266_GND->GND

Attention

The size of data from ESP8266 is too big for arduino sometimes, so the library can't receive the whole buffer because the size of the hardware serial buffer which is defined in HardwareSerial.h is too small.

Open the file from \arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h. See the follow line in the HardwareSerial.h file.

#define SERIAL_BUFFER_SIZE 64

The default size of the buffer is 64. Change it into a bigger number, like 256 or more.


The End!


iteadlib_arduino_weeesp8266's People

Contributors

hedda avatar ivankravets avatar tobiasschaber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iteadlib_arduino_weeesp8266's Issues

Serial1

Hello

Where is this declared ? I have an issue when compiling.

Mickael.

error: no matching function for call to 'ESP8266::ESP8266(SoftwareSerial&)'

Hi,

I'm a noob, so forgive me if this isn't the right place to post.

I have an UNO and are using SoftwareSerial to connect to my ESP8266.

When I compile, I get the following error "error: no matching function for call to 'ESP8266::ESP8266(SoftwareSerial&)'" when it reaches the line below "ESP8266 wifi(mySerial);"

Below is a snippet of my code.

-----Snip-----

include "ESP8266.h"

define SSID "farm"

define PASSWORD "sheep"

define USER_SEL_VERSION VERSION_18

define ESP8266_USE_SOFTWARE_SERIAL

include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

ESP8266 wifi(mySerial);

void setup(void)
----Snip-----

Regards

Dean

Flashing version 0.22 AT firmware

Hello,
I am having trouble getting my esp8266 to communicate via UART with my Arduino Mega.
I downloaded the SDK version 1.0.0 with AT firmware version 0.22 from the
espressif website
Here are the files I flashed using the NodeMCU flasher program for Windows:
boot_v1.2.bin at 0x00000
user1.512.new.bin at 0x01000
blank.bin at 0x7E000

Are these files the correct ones, with the correct offsets?

Is there a way to ensure that I have the correct firmware installed before running the "test" example?
Thank you.

how to DEBUG this library,

hi boes:
i want to see whta at comman we send & what i recved, but if i ouput with
Serial.println();
all operation will be failed, but if i do NOT out, all are ok. any suggest???

THX

[changed] AT+CIPMODE

Hello,
exist some possibility to change baud rate for hardware serial and software serial from main sketch?

or i must change it in ESP8266.h ??

and if not exist can you modify lib for doing that

UDP

Help me, please!
Code in standart WiFi Arduino module for UDP:

void setup() {
...
Udp.begin(localPort);
}
void loop() {

// if there's data available, read a packet
int packetSize = Udp.parsePacket();
if (packetSize){ ... }

}

How to use your library to listen UDP packets to a specific port?

JoinAP

Hi,

My ESP8266 firmware is
AT+GMR

AT version:0.21.0.0
SDK version:0.9.5

OK

My arduino is a leonardo R3

I have used for the first time your library this weekend. I was not able to use your example ConnectWifi.
I have update the example with my SSID and password. and also ESP8266 object creation as follow
ESP8266 wifi(Serial1,115200);

the log I get is something like this:

setup begin
FW Version:0.21.0.0
to station ok
Join AP failure
setup end

In my first test application of the ESP8266 I was doing as follow and it able to join the SSID
String cmd="AT+CWMODE=1";
Serial.print("SEND: ");
Serial.println(cmd);
Serial1.println(cmd);
Serial1.flush();
delay(2000);
cmd="AT+CWJAP="";
cmd+=ssid;
cmd+="","";
cmd+=pwd;
cmd+=""";
Serial.print("SEND: ");
Serial.println(cmd);
Serial1.println(cmd);
Serial1.flush();
delay(5000);
return Serial1.find("OK");

I have a look to your .CPP file, and you are doing quite the same but I was not able to connect my WIFI.

I test I have updated you .CPP file as follow,

bool ESP8266::joinAP(String ssid, String pwd)
{

//sATCWMODE(1);
delay(2000);
String cmd="AT+CWMODE=1";

Serial.print("SEND: ");
Serial.println(cmd);
m_puart->println(cmd);
m_puart->flush();
delay(2000);
cmd="AT+CWJAP="";
cmd+=ssid;
cmd+="","";
cmd+=pwd;
cmd+=""";
Serial.print("SEND: ");
Serial.println(cmd);
m_puart->println(cmd);
m_puart->flush();
delay(5000);
return m_puart->find("OK");

}

and this time i was able to connect my WIFI.

any clue for me?

Regards

I have also try without success:
modifying
bool ESP8266::sATCWJAP
bool ESP8266::sATCWJAP(String ssid, String pwd)
{
String data;
rx_empty();
m_puart->print("AT+CWJAP="");
Serial.print("AT+CWJAP="");

m_puart->print(ssid);
Serial.print(ssid);

m_puart->print("\",\"");
Serial.print("\",\"");

m_puart->print(pwd);
Serial.print(pwd);

m_puart->println("\"");
Serial.println("\"");

delay(5000);
return m_puart->find("OK");

/*
data = recvString("OK", "FAIL", 10000);
if (data.indexOf("OK") != -1) {
return true;
}
return false;
*/
}

the output was AT+CWJAP="MYSSID","MYPASSWORD"

getLocalIP() returns empty string after connecting to AP

The following code:

 auto str = wifi.getJoinedDeviceIP();
 cout.print("wifi.getJoinedDeviceIP() = ");
 cout.println(str);

returns "" even after connecting to an AP. This code was inserted into the example code, and all the other "debug" print statements look correct (i.e. I'm sure I'm connecting to AP and setting up server correctly).

API Error in Examples

Compiling the "HTTPGET" example, throws this error:

HTTPGET:32: error: no matching function for call to 'ESP8266::ESP8266(SoftwareSerial&)'

returning empty string

In bool ESP8266::recvFindAndFilter

at the end it has:

data = "";
return false;

If those two if statements are never satisfied it returns an empty string which shouldn't happen, but when it does it appears like the library isn't working, when it's just a minor bug. I think instead it should be:

data = data_tmp;
return false;

That way if the filter doesn't work, it'll just return the full string.

ESP8266 wifi(mySerial);

I'm using an arduino nano v3 and I got this error

ConnectWiFi:28: error: no matching function for call to ‘ESP8266::ESP8266(SoftwareSerial&)’
/home/ricardo/.AIDE/arduino/libraries/WeeESP8266-master/ESP8266.h:37: note: candidates are: ESP8266::ESP8266(HardwareSerial&)
/home/ricardo/.AIDE/arduino/libraries/WeeESP8266-master/ESP8266.h:29: note: ESP8266::ESP8266(const ESP8266&)

If I just write

ESP8266 wifi(Serial);

Apparently my problem has gone but I can't connect the ESP with my AP

Any idea?

Connecting ESP8266 + Arduino UNO

Hi,
I am trying to connect ESP8266 and Arduino UNO. I downloaded the ESP8266 library and tried the ConnectWifi program in it. But I am not able to connect to the wifi network. It is giving me the following error.
setup begin
FW Version:
to station err
Join AP failure
setup end

PFB the program I have uploaded:

include "ESP8266.h"

include "SoftwareSerial.h"

SoftwareSerial mySerial(3,2);
ESP8266 wifi(mySerial);

define SSID "--------"

define PASSWORD "------------------"

//#define SERIAL_BUFFER_SIZE 256
//#define SERIAL_RX_BUFFER_SIZE 64

//ESP8266 wifi(Serial);
void setup(void)
{
Serial.begin(9600);
mySerial.begin(115200);
Serial.print("setup begin\r\n");

Serial.print("FW Version: ");
Serial.println(wifi.getVersion().c_str());


if (wifi.setOprToStation()) {
    Serial.print("to station ok\r\n");
} else {
    Serial.print("to station err\r\n");
}

if (wifi.joinAP(SSID, PASSWORD)) {
    Serial.print("Join AP success\r\n");
    Serial.print("IP: ");       
    Serial.println(wifi.getLocalIP().c_str());
} else {
    Serial.print("Join AP failure\r\n");
}

Serial.print("setup end\r\n");

}

void loop(void)
{
}
Kindly someone help me to connect the shield with the network. I already made some research with other issues section in Git hub but nothing happened.
Thanks in advance.

waitForStable()

This could be useful method by itself. You had it in the restart method. Similar to the kick() method, except it just keeps waiting. Every once in a while my board just seems to lock up, it would be nice if we could make it auto-reset itself. I haven't gotten that far yet. :-)

bool ESP8266::waitForStable(void)
{
unsigned long start = millis();
while (millis() - start < 3000) {
if (eAT()) {
delay(1500); /* Waiting for stable */
return true;
}
delay(100);
}
}

extra \r in eATCIFSR

Extra \r in eATCIFSR

change
return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list);

to:
return recvFindAndFilter("OK", "\r\n", "\r\n\r\nOK", list);

Monitoring wifi package

Hi everyone,

I need to monitoring WiFi package.
I'm not sure "ITEADLIB_Arduino_WeeESP8266" can use.

I'm not good English **

Thank you

Problems using SoftwareSerial as ESP8299 port

I'm running the example TCPClientSingleUNO it's straight forward, however when I complile with only the #defines needed to connect changed I get this.
TCPClientSingleUNO.ino:30:22: error: no matching function for call to 'ESP8266::ESP8266(SoftwareSerial&)'
ESP8266.h defines this. Any ideas where the problem my lay?

Create UDP Server methods

I guess it makes sense to add startUDPServer method similar to TCP's startTCPServer methods (and stopTCPServer, setTCPServerTimeout too).
The AT command for this is the same so it should not be a problem. We are missing the ability to recieve UDP data with current version of the library. (Should use startTCPServer with my UDP Server which is confusing).

Create TCP Error?

Hi, thanks for the great library, but i have a problem using it.

I test my board with the example "HTTPGET" . But i got an error. "create tcp err".

I have changed www.baidu.com to a local server running on my computer but still get the same error.

Here is the log:

setup begin
FW Version:AT+GMR
00200.9.5(b1)
compiled @ Dec 25 2014 21:40:28
AI-THINKER Dec 25 2014

OK

to station + softap ok
Join AP success
IP:AT+CIFSR
+CIFSR:APIP,"192.168.4.1"
+CIFSR:APMAC,"1a:fe:34:a2:ff:e3"
+CIFSR:STAIP,"192.168.1.5"
+CIFSR:STAMAC,"18:fe:34:a2:ff:e3"

OK

single ok
setup end
create tcp err
release tcp err

Cant Connect Wee +ESP-12 + UNO

Hello, Recently I bough a ESP8266 ESP-12-Q and I would Like to connect it to Arduino UNO, so that I can control sensors from the internet.
This one: image of esp-12

And Im using the code below, which I got from here: #36

#include <ESP8266.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 2); // uno sw RX(pin3) --> wifi TX, uno sw TX(pin2) --> wifi RX
ESP8266 wifi(mySerial);

void setup() {
 Serial.begin(9600);
 mySerial.begin(115200);

 setupESP8266();
}

void loop (){

}
void setupESP8266()
{
    while (1) {
        Serial.print("restaring wifi...");
        if (wifi.restart()) {
            Serial.print("ok\r\n");
            break;
        }
        else {
            Serial.print("not ok...\r\n");
            Serial.print("Trying to kick...");
            while (1) {
                if (wifi.kick()) {
                    Serial.print("ok\r\n");
                    break;
                }
                else {
                    Serial.print("not ok... Wait 5 sec and retry...\r\n");
                    delay(5000);
                }
            }
        }
    }

    Serial.print("setup begin\r\n");
    Serial.print("FW Version:");
    Serial.println(wifi.getVersion().c_str());

    while (1) {
        if (wifi.setOprToStation()) {
            Serial.print("to station ok\r\n");
            break;
        }
        else {
            Serial.print("to station err\r\n");
            Serial.println("Wait 5 seconds and try again...");
            delay(5000);
        }
    }

    while (1) {
        if (wifi.joinAP("MYNETWORK", "PASS")) {
            Serial.print("Join AP success\r\n");
            break;
        }
        else {
            Serial.print("Join AP failure\r\n");
            Serial.println("Wait 5 seconds and try again...");
            delay(5000);
        }
    }
    Serial.print("setup end\r\n");
}

I connected like this:

ESP --------- External Power (3.3V 1A) ---------- UNO
Vcc 3.3V
GRD GRD
CH_PD(EN) 3.3v
TX ------------------------------------------------------ Digital 3
RX ------------------------------------------------------ Digital 2

When I open the Serial Console this is the info I get:

Serial Console

I tried several speeds for the software serial (9600, 19200, 115200) no worked.. always the same thing. What am I missing here?
Any tip helps! I really would like to use Wee, fits perfectly to my project but I can not get this ESP working....

Thank you for your time!

String objects stop responding to appends in recvString

I'm using an atmega32u4 board and working with this library.. Sometimes things seem to work pretty well, but every other reset or so.. wifi.getIpStatus() was returning a blank string. I added some debugging to the recvString method and it is clearly reading the correct data from the ESP (by printing out the characters as they arrive). However, the string append seems to be failing (probably due to memory issues). Printing the length of the string after the "data += a" line is always returning 0.

Do you have any suggestions for how I might use this library and avoid this issue? I've started refactoring the library to use cstrings instead of Arduino StringObjects in the hopes that it'll fix this and cause the library to use significantly less memory. I'll provide a fork and pull request if/when I finish this refactoring.

Join Access Point failed

10 000 milliseconds for connect to AP - very small. ESP have not time to connect AP.
20000 milliseconds - good.

releaseTCP error

When you call releaseTCP() and the module is still receiving content after a send() command the release command will fail. It took me a while to figure this out... my current workaround is to add a 10s delay after send() but that's not really a longterm solution.

The problem is that if you use a small receive buffer, say 128 bytes, it exits way before all the content is received.

Why didn't you implement the Arduino WiFi Shield API?

This is a question and it's also related to #30 issue.

There is an MQTT implementation for ESP8266 and (probably it also can be used for) Arduino, it's based on the WiFi Shield API, as I understand. Also as I see people try to implement the WiFi Shield API to make their libraries compatible with other existing libraries which use WiFi.

The question is why did you decide to create your own API instead of implementing the WiFi Shield API which is a de-facto standard for Arduino, as I see it?

In theory, I can be wrong, if this library would has the WiFi Shield API, then it could be easy to use the mentioned MQTT implementation and any other.

esp8266 was not declared in this scope

I am using the above code
`#include

include

include

define SSID "SSID"

define PASSWORD "Password"

SoftwareSerial mySerial(3, 2); /* RX:D3, TX:D2 */
ESP8266 wifi(mySerial);
void setupesp8266()
{
while (1) {
Serial.print("restaring esp8266...");
if (esp8266.restart()) {
Serial.print("ok\r\n");
break;
}
else {
Serial.print("not ok...\r\n");
Serial.print("Trying to kick...");
while (1) {
if (esp8266.kick()) {
Serial.print("ok\r\n");
break;
}
else {
Serial.print("not ok... Wait 5 sec and retry...\r\n");
delay(5000);
}
}
}
}
Serial.begin(9600);
mySerial.begin(115200);
Serial.print("setup begin\r\n");
Serial.print("FW Version: ");
Serial.println(esp8266.getVersion().c_str());
if (esp8266.setOprToStation()) {
Serial.print("to station ok\r\n");
break;
} else {
Serial.print("to station err\r\n");
Serial.println("Wait 5 seconds and try again...");
delay(5000);
}
while(1){
if (esp8266.joinAP(SSID, PASSWORD)) {
Serial.print("Join AP success\r\n");
Serial.print("IP: ");

Serial.println(wifi.getLocalIP().c_str());
break;
} else {
Serial.print("Join AP failure\r\n");
Serial.println("Wait 5 seconds and try again...");
delay(5000);
}

}
Serial.print("setup end\r\n");

}
void setup(void)
{
setupesp8266();
}
void loop(void)
{
}
`
but is giving following error

ConnectWiFi:12: error: 'esp8266' was not declared in this scope

 if (esp8266.restart()) {

     ^

ConnectWiFi:35: error: 'esp8266' was not declared in this scope

Serial.println(esp8266.getVersion().c_str());

            ^

ConnectWiFi:38: error: break statement not within loop or switch

 break;

 ^

Using library ESP8266Wifi in folder: C:\Users\admin\Documents\Arduino\libraries\ESP8266Wifi (legacy)
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
exit status 1
'esp8266' was not declared in this scope

please help me

Using with tiva c 123gxl

Good night. How can I use this library with Texas Instrument Tiva C 123gxl and Energia IDE?
I've try, but without success.

Compiling with arduino IDE 1.6.6

does anyone know what is the Problem? i can not compile it with arduino IDE 1.6.6, i get this error:
...WeeESP8266-master/ESP8266.h:38:7: note: in expansion of macro 'ESP8266'
class ESP8266 {

   ^

:0:9: error: expected unqualified-id before numeric constant

thanks!

unit8_t compare

Why unit8_t? i realy can't convert it to ssomewhat, that i can compare with String or maybe int data types
can i change recived data type?

arduino due freeze

the code

ESP8266 wifi(Serial2);

for arduino due defined as global freeze all serial ports.

I need to move inside setup.

void setup(void)
{
    Serial.begin(9600);
    Serial.print("setup begin\r\n");
    ESP8266 wifi(Serial2);
    Serial.print("FW Version:");
    Serial.println(wifi.getVersion().c_str());

Large Buffer

The example in /examples/HTTPGET cannot work on UNO.
It always failed to establish a tcp connection.
After I change the buffer size in line 65 from 1024 to 128, it worked smoothly.
So I wondered this is an issue or not?

Binary data is not return correctly if contains 0x00

The following line in uint32_t ESP8266::recvPkg(uint8_t *buffer, uint32_t buffer_size, uint32_t *data_len, uint32_t timeout, uint8_t *coming_mux_id)

memcpy(buffer,
data.substring(index_colon + 1, index_colon + 1 + len).c_str(),
ret);

(around line 367 of ESP8266.cpp)

Returns incomplete data if a 0x00 occurs in 'data' as this is interpreted as '\0' and terminates the string. I have made a hacky solution by buffering all incoming data in a char array 'charData', and replacing the above with the following:

memcpy(buffer, &charData[index_colon + 1], ret);

I would advise using a statically assigned char array as a global buffer for all of your functions, rather than using the arduino String object, as the dynamic memory allocation is slow and may cause problems.

Udp message not received

The tcp messages sending and receiving fine , but the udp message not being received
any one facing same problem ?

Pinout

It would be good to include the pinout in the readme

len = wifi.recv(buffer, sizeof(buffer), 200);

I am trying to connect two arduino UNO using this code but there is some issue in following function..

len = wifi.recv(buffer, sizeof(buffer), 200);

ERROR:
client.ino: In function ‘void loop()':
client:48: error: ‘class ESP8266′ has no member named ‘recv’
‘class ESP8266′ has no member named ‘recv’

Please provide me a solution for this

NTP client

Please tell me can this library connect to ntp server and get unix time?

TCP server not working after 1 connection

Hello,
i found your great library but i'm having some issues with the TCP server.
With the given example after 1 successfully request i am unable to do a second one. No reponse whatsoever.
Do you have any idea why ?

Thank you in advance!

extra \r in eATGMR

In bool ESP8266::eATGMR I think there is an extra \r at least with my version of the esp8266 (0020000903 compiled @ Dec 15 2014 19:43:31 AITHINKER-20141206)

change:
return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", version);

to:
return recvFindAndFilter("OK", "\r\n", "\r\n\r\nOK", version);

Can't get local ip.

Hello,
I am having a problem with the getLocalIP() function as it only returns a white space.

Example :

00160901
reset ok
to access point ok
Join AP success
 <--- This is where I should get the ip, but it displays a white space instead.
multiple ok
start server ok
setup end

Here is my setup code.

#include "ESP8266.h"

#define SSID        "ssid"
#define PASSWORD    "pass"

ESP8266 wifi(Serial1);

void setup() {
    Serial.begin(115200);

    // GET FIRMWARE VERSION OF THE ESP8266
    Serial.println(wifi.getVersion().c_str());

    // RESET WIFI
    if (wifi.restart()) {
        Serial.print("reset ok\r\n");
    } else {
        Serial.print("reset failure\r\n");
    }

    // SET MODE
    if (wifi.setOprToStation()) {
        Serial.print("to access point ok\r\n");
    } else {
        Serial.print("to access point err\r\n");
    }

    // REACH ACCESS POINT
    if (wifi.joinAP(SSID, PASSWORD)) {
        Serial.print("Join AP success\r\n");
        Serial.println(wifi.getLocalIP().c_str());
    } else {
        Serial.print("Join AP failure\r\n");
    }

    // ENABLE MULTIPLE CONNECTION
    if (wifi.enableMUX()) {
        Serial.print("multiple ok\r\n");
    } else {
        Serial.print("multiple err\r\n");
    }

    // START SERVER
    if (wifi.startTCPServer(8000)) {
        Serial.print("start server ok\r\n");
    } else {
        Serial.print("start server err\r\n");
    }

    Serial.print("setup end\r\n");
}

Thank you for the lib by the way, despite this little thing, it works great.

extra \r in eATCWLAP

bool ESP8266::eATCWLAP

extra \r

change:

return recvFindAndFilter("OK", "\r\r\n", "\r\n\r\nOK", list, 10000);
to:

return recvFindAndFilter("OK", "\r\n", "\r\n\r\nOK", list, 10000);

setOprToStation() is returning False

include <doxygen.h>

include <ESP8266.h>

include <SoftwareSerial.h>

define SSID "ghini"

define PASSWORD "counterstrike"

SoftwareSerial mySerial(3, 2); /* RX:D3, TX:D2 */
ESP8266 wifi(mySerial);
void setup(void)
{
Serial.begin(9600);
mySerial.begin(9600);
Serial.print("setup begin\r\n");
Serial.print("FW Version: ");
Serial.println(wifi.getVersion().c_str());
if (wifi.setOprToStation()) {
Serial.print("to station ok\r\n");

} else {
    Serial.print("to station err\r\n");
      Serial.println("Wait 5 seconds and try again...");
        delay(5000);
}

while(1){
if (wifi.joinAP(SSID, PASSWORD)) {
Serial.print("Join AP success\r\n");
Serial.print("IP: ");
Serial.println(wifi.getLocalIP().c_str());
break;
} else {
Serial.print("Join AP failure\r\n");
Serial.println("Wait 5 seconds and try again...");
delay(5000);
}

}
Serial.print("setup end\r\n");

}
void loop(void)
{
}

I have connected esp8266 to arduino uno as
ESP8266_TX->RX1(D19)
ESP8266_RX->TX1(D18)
ESP8266_CH_PD->3.3V
ESP8266_VCC->3.3V
ESP8266_GND->GND.
setOprToStation() is returning False every time try to connect with the AP.

Please help me

MQTT & REST support

Are you planning to add MQTT and REST support to your awesome library?
This would be enormous for IoT projects.
I do not want to run the ESP8266 as standalone - because of some other reasons.
But there is no solution out there to have a ESP8266 connected to Arduino or Teensy
and use MQTT library directly on your Arduino / Teensy.

sending email

Hello

Is there any way to send an mail using the library ?

Mickael.

Failure while using the example

Thank you for your library, you are very kind for the arduino community.
Here is the issue I faced while using the library, I was fine when I use standalone AT command.
Like the one below, it is fully functional.

AT version:0.21.0.0
SDK version:0.9.5

Yet, when I am using the library, it all goes err.
Mine is Arduino Uno, ESP8266 version as above.
Is it my hardward problem or should I update my firmware?

AT+GMR
AT+CWMODE?
to station err
AT+CWJAP="SSID","PASSWORD"
Join AP failure
setup end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.