Git Product home page Git Product logo

esp8266wifi's Introduction

SerialESP8266wifi

A simple ESP8266 Arduino library with built in re-connect functionality.

Memory footprint and more

  • Tested on an Arduino Nano v3 ATMega 328, Arduino IDE 1.60, ESP8266 module with firmware version 0.9.2.4
  • approx 3.5kB of program storage
  • approx 285 bytes or RAM

Install

Constructor

SerialESP8266wifi(Stream serialIn, Stream serialOut, byte resetPin)

  • serialIn this object is used to read from the ESP8266, you can use either hardware or software serial
  • serialOut this object is used to write to the ESP8266, you can use either hardware or software serial
  • resetPin this pin will be pulled low then high to reset the ESP8266. It is assumed that a the CH_PD pin is connected the this pin. See pin out and more at: http://www.electrodragon.com/w/ESP8266#Module_Pin_Description
  • Example: SerialESP8266wifi wifi(swSerial, swSerial, 10);

SerialESP8266wifi(Stream serialIn, Stream serialOut, byte resetPin, Stream debugSerial)

  • serialIn this object is used to read from the ESP8266, you can use either hardware or software serial
  • serialOut this object is used to write to the ESP8266, you can use either hardware or software serial
  • resetPin this pin will be pulled low then high to reset the ESP8266. It is assumed that a the CH_PD pin is connected the this pin. See pin out and more at: http://www.electrodragon.com/w/ ESP8266#Module_Pin_Description
  • debugSerial enables wifi debug and local echo to Serial (could be hw or sw)
  • Example: SerialESP8266wifi wifi(swSerial, swSerial, 10, Serial);

Starting the module

boolean begin() calling this method will do a hw reset on the ESP8266 and set basic parameters

  • return will return a true or false depending if the module was properly initiated
  • Example: boolean esp8266started = wifi.begin();

Connecting to an access point

boolean connectToAP(char * ssid, char password)* tells the ESP8266 to connect to an accesspoint

  • ssid the ssid (station name) to be used. Note that this method uses char arrays as input. See http://arduino.cc/en/Reference/StringToCharArray for how to convert an arduino string object to a char array (max 15 chars)
  • password the access point password wpa/wpa2 is assumed (max 15 chars)
  • return will return a true if a valid IP was received within the time limit (15 seconds)
  • Example: boolean apConnected = wifi.connectToAP("myaccesspoint", "password123");

boolean isConnectedToAP() checks if the module is connected with a valid IP

  • return will return a true if the module has an valid IP address
  • Example: boolean apConnected = wifi.isConnectedToAP();

Connecting to a server

boolean connectToServer(char ip, char port)** tells the ESP8266 to open a connection to a server

  • ip the IP-address of the server to connect to
  • port the port number to be used
  • return true if connection is established within 5 seconds
  • Example: boolean serverConnected = wifi.connectToServer("192.168.5.123", "2121");

boolean isConnectedToServer() checks if a server is connected

  • return will return a true if we are connected to a server
  • Example: boolean serverConnected = wifi.isConnectedToServer();

setTransportToTCP() AND setTransportToUDP() tells the ESP8266 which transport to use when connecting to a server. Default is TCP.

Disconnecting from a server

disconnectFromServer() tells the ESP8266 to close the server connection

  • Example: wifi.disconnectFromServer();

Sending a message

boolean send(char channel, char * message) sends a message - alias for send(char channel, char * message, true)

  • channel Set to SERVER if you want to send to server. If we are the server, the value can be between '1'-'3'
  • message a character array, max 25 characters long.
  • return true if the message was sent
  • Example: boolean sendOk = wifi.send(SERVER, "Hello World!");

boolean send(char channel, char * message, boolean sendNow) sends or queues a message for later sending

  • channel Set to SERVER if you want to send to server. If we are the server, the value can be between '1'-'3'
  • message a character array, max 25 characters long.
  • sendNow if false, the message is appended to a buffer, if true the message is sent right away
  • return true if the message was sent
  • Example:
wifi.send(SERVER, "You", false);
wifi.send(SERVER, " are ", false);
wifi.send(SERVER, "fantastic!", true); // ie wifi.send(SERVER, "fantastic!");

endSendWithNewline(bool endSendWithNewline) by default all messages are sent with newline and carrage return (println), you can disable this

  • endSendWithNewline sent messages with print instead of println
  • Example: wifi.endSendWithNewline(false);

Checking Client Connections

boolean checkConnections(&connections) - Updates pre-initialised pointer to WifiConnection *connections.

  • return true if client is connected
  • Updated pointer is array of 3 connections:
    • boolean connected true if connected.
    • char channel channel number, can be passed to send.
  • Example:
WifiConnection *connections;

wifi.checkConnections(&connections);
for (int i = 0; i < MAX_CONNECTIONS; i++) {
  if (connections[i].connected) {
    // See if there is a message
    WifiMessage msg = wifi.getIncomingMessage();
    // Check message is there
    if (msg.hasData) {
      processCommand(msg);
    }
  }
}

Check Connection

boolean isConnection(void) - Returns true if client is connected, otherwise false. Use as above without WifiConnection pointer if not bothered about multi-client.

Get Incoming Message From Connected Client

WifiMessage getIncomingMessage(void) - checks serial buffer for messages. Return is WifiMessage type as below. See example Check Client Connection example for usage.

Receiving messages

WifiMessage listenForIncomingMessage(int timeoutMillis) will listen for new messages up to timeoutMillis milliseconds. Call this method as often as possible and with as large timeoutMillis as possible to be able to catch as many messages as possible..

  • timeoutMillis the maximum number of milliseconds to look for a new incoming message
  • return WifiMessage contains:
  • boolean hasData true if a message was received
  • char channel tells you if the message was received from the server (channel == SERVER) or another source
  • char * message the message as a character array (up to the first 25 characters)
  • Example:
void loop(){
    WifiMessage in = wifi.listenForIncomingMessage(6000);
    if (in.hasData) {
        Serial.print("Incoming message:");
        Serial.println(in.message);
        if(in.channel == SERVER)
            Serial.println("From server");
        else{
            Serial.print("From channel:");
            Serial.println(in.channel);
        }
    }
    // Do other stuff
 }

Local access point and local server

boolean startLocalAPAndServer(char ssid, char password, char* channel, char* port)** will create an local access point and start a local server

  • ssid the name for your access point, max 15 characters
  • password the password for your access point, max 15 characters
  • channel the channel for your access point
  • port the port for your local server, TCP only
  • return true if the local access point and server was configured and started
  • Example: boolean localAPAndServerStarted = wifi.startLocalAPAndServer("my_ap", "secret_pwd", "5", "2121");

boolean stopLocalAPAndServer() disable the accesspoint (the server will not be stopped, since a restart is needed)

  • return true if the local access point was stopped
  • Example: boolean localAPAndServerStopped = wifi.stopLocalAPAndServer();

boolean isLocalAPAndServerRunning() check if local access point and server is running

  • return true if the local access point and local server is running
  • Example: boolean localAPAndServerRunning = wifi.isLocalAPAndServerRunning();

Re-connect functionality

Everytime send(...) and listenForIncomingMessage(..) is called a watchdog checks that the configured access point, server and local access point and server is still running, if not they will be restarted or re-connected. The same thing happens if the ESP8266 should reset. Note: It is really only the send method that can detect a lost connection to the server. To be sure you are connected, do a send once in a while..

Avanced configuration

In SerialESP8266wifi.h you can change some stuff:

  • HW_RESET_RETRIES 3 - is the maximum number of times begin() will try to start the ESP8266 module
  • SERVER_CONNECT_RETRIES_BEFORE_HW_RESET 30 - is the nr of time the watchdog will try to establish connection to a server before a hardware reset of the ESP8266 is performed
  • The maximum number of characters for incoming and outgoing messages can be changes by editing:
    • char msgOut[26];
    • char msgIn[26];
  • If the limit for ssid and password length does not suite you, please change:
    • char _ssid[16];
    • char _password[16];
    • char _localAPSSID[16];
    • char _localAPPassword[16];

esp8266wifi's People

Contributors

cederberg avatar ekstrand avatar ivankravets avatar jlusiardi avatar tuna-f1sh avatar zen 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

esp8266wifi's Issues

ESP8266_WiFi

hello sir,

i am new to this ESP8266 project in this i have some confusion that i have to different sdk that is ESP8266_NONOS_SDK and ESP8266_RTOS_SDK , i want to know which SDK shall i use for my project.. actually in my project i am having one hand held device and a meter both are embed with ESP8266 module i want to read the meter using the hand held device through WI-FI communication.
i want to know how can i do this please give me some advice as soon as possible.
Thanks and regards,
Thangellan

Missing method for local IP

Dear ekstrand,

First of all, nice work with this library!

Other libraries have a function called ESP8266Wifi.localIP which returns the local IP. Is there a similar function in your library?

All the best.

WIFI_STATE_CONNECT or WIFI_STATE_IDLE

I tried running example "Simple_TCP_Client", however it didn't work.

Looking in the code I found the following:
connectTCP() exits with: setRunningState(WIFI_STATE_CONNECT)
send() test on if(getRunningState() == WIFI_STATE_IDLE)
This is, in my case, always false so nothing is send.

I resolved this by changing in: if(getRunningState() == WIFI_STATE_CONNECT)
Then is works !

I'm totally not sure if my findings or solution is the right !!!!!!!

Can't Connect to Wifi Network

While using a Surface Pro 3, I am not able to connect to the ESP8266. My device realizes that the network is there, but says, "Can't connect to this network." The funny thing is that I was able to connect beforehand.

I have tried re-flashing and restarting.

AT_firmware for ESP_01

Dear Jonas,

Thanks for this very impressive library.

I see you tested with Firmware 0.9.2.4 does this also fit in an ESP_01 ? and where can I obtain this firmware.
I tried flashing AT_firmware V1.3.0.2 for ESP_12 but I'm affraid it is too large.

Thank Maarten

Local Web Server, STM32 blue pill

I am using the STM32 Blue pill board, connected to an ESP-07 module by the serial port 2, I need to make a local web server, which can be accessed from the web browser, who can set an example to guide me.
Thank you

Serial and swSerial in the example ESP8266_tcp_cli.ino

swSerial and Serial are changed in the example ESP8266_tcp_cli.ino
ESP8266wifi wifi(Serial, Serial, esp8266_reset_pin, swSerial);
Correct:
ESP8266wifi wifi(swSerial, swSerial, esp8266_reset_pin, Serial);

Thank you very much for the library!

Compatibility Issues with Ethernet library

Basically I want to convert the Settimino (arduino Snap7 library) across to WiFi using the nodeMCU as an arduino. I have edited the Settimino library to #include ESP8266WiFi and changed the class from ethernet to WiFi, however I get compiler errors from Arduino IDE that I dont quite know how to fix.

Has anyone else had experience with porting an ethernet based library to wifi or how to fix these errors.

Thank you.

In file included from \Documents\Arduino\libraries\Settimino\Settimino.h:42:0,

from \Documents\Arduino\libraries\Settimino\Settimino.cpp:26:

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h: In instantiation of 'size_t WiFiClient::write(T&, size_t) [with T = unsigned char [22]; size_t = unsigned int]':

\Documents\Arduino\libraries\Settimino\Settimino.cpp:426:41: required from here

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:123:36: error: request for member 'available' in 'source', which is of non-class type 'unsigned char [22]'

size_t left = source.available();

^

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:127:5: error: request for member 'read' in 'source', which is of non-class type 'unsigned char [22]'

source.read(buffer.get(), will_send);

^

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h: In instantiation of 'size_t WiFiClient::write(T&, size_t) [with T = unsigned char [25]; size_t = unsigned int]':

\Documents\Arduino\libraries\Settimino\Settimino.cpp:446:39: required from here

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:123:36: error: request for member 'available' in 'source', which is of non-class type 'unsigned char [25]'

size_t left = source.available();

^

C:\Users\Geoff-Work\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:127:5: error: request for member 'read' in 'source', which is of non-class type 'unsigned char [25]'

source.read(buffer.get(), will_send);

^

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h: In instantiation of 'size_t WiFiClient::write(T&, size_t) [with T = unsigned char [35]; size_t = unsigned int]':

\Arduino\libraries\Settimino\Settimino.cpp:543:34: required from here

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:123:36: error: request for member 'available' in 'source', which is of non-class type 'unsigned char [35]'

size_t left = source.available();

^

\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:127:5: error: request for member 'read' in 'source', which is of non-class type 'unsigned char [35]'

source.read(buffer.get(), will_send);

^

exit status 1
Error compiling. - See more at: http://www.esp8266.com/viewtopic.php?f=6&t=11109&e=0#sthash.kz6iclMu.dpuf

No Port value's above 32000

My TCP server port is on 50050, the SW uses int for port.
I changed on 3 positions in ESP8266_TCP library the port declaration to "unsigned int" and it was resoved.

Error receiving a message from the server

I am testing the SerialESP8266_library_test.ino example, with some modifications for the STM32 Blue pill board. When I send a message to the server, it returns a response.
If I enable the debug by the serial port, the answer is complete, but when using the wifirecived function, the first character disappears, the S of SUCCESS does not reach me.

Code

#include <SerialESP8266wifi.h>

#define esp8266_reset_pin PC13 // Connect this pin to CH_PD on the esp8266, not reset. (let reset be unconnected)

#define WIFI_SSID "Rayen"
#define WIFI_PASS "87654321"

#define DST_IP "192.168.0.157"
#define DST_Port "9221"


// the last parameter sets the local echo option for the ESP8266 module..
SerialESP8266wifi wifi(Serial2, Serial2, esp8266_reset_pin,Serial); //adding Serial enabled local echo and wifi debug

String inputString;
boolean pasada = 1, stringComplete = false;
unsigned long nextPing = 0;

void setup() {
  bool conectado = 0;
  inputString.reserve(30);
  Serial2.begin(115200);
  Serial.begin(9600);
  while (!Serial)
    ;
  Serial.println("Starting wifi");

  wifi.setTransportToTCP();// this is also default
  // wifi.setTransportToUDP();//Will use UDP when connecting to server, default is TCP

  wifi.endSendWithNewline(true); // Will end all transmissions with a newline and carrage return 
  wifi.begin();

  //Turn on local ap and server (TCP)
 //wifi.startLocalAPAndServer(WIFI_SSID, WIFI_PASS, "5", "2121");
 //wifi.startLocalServer("2121");
 delay(10);
  conectado = wifi.connectToAP(WIFI_SSID, WIFI_PASS);
  while (!conectado) {
    delay(10);
  }
  delay(100);
  Serial.println("Envio AT+CIPMUX=1");
  Serial2.println("AT+CIPMUX=1");
  delay(100);
  conectado = wifi.connectToServer(DST_IP, "9221");
  delay(100);
  Serial.println("-----Fin Setup-----");
}

void loop() {
  if (pasada) {
    Serial.println("-----Enviando datos-----");
    Serial2.println("AT+CWJAP_CUR?");
    // wifi.writeCommand(SERVER,"AT+CWJAP_CUR?");
    delay(1000);
    wifi.send(SERVER,"/dev/Medi123/savean0=4.9&u=Medi123&p=12345&d=1421080339&z=p\n");

    delay(5000);
    pasada = 0;
        WifiMessage in = wifi.listenForIncomingMessage(5000);
    if (in.hasData) {
        Serial.print("Mensaje recibido:");
        Serial.print(in.message);
        if(in.channel == SERVER)
            Serial.println("Del Server");
        else{
            Serial.print("Por canal:");
            Serial.println(in.channel);
        }
    }
    
  }

}

Answer (serial debug)

JAP_CUR?

+CWJAP_CUR:"Rayen","d4:6e:0e:f3:65:2e",7,-56

OK
TAIP,"192.168.0.106"
+CIFSR:STAMAC,"bc:dd:c2:ed:8f:49"

OK

AT+CIPSEND=4,63

OK
> 
Recv 63 bytes

SEND OK

+IPD,4,36:SUCCESS

DATE=1420821139;1554917753

Mensaje recibido:UCCESS

DATE=1420821139;1554917753
Del Server

Sending string message to server via AP

How can I send string messge to the server: example.com:8080 via AP on my mobile phone?

Can I use this code?
wifi.connectToAP("myaccesspoint", "password123");
wifi.connectToServer("example.com", "8080");
wifi.send("example.com", "Hello World!");

Examples wont compile

I am using Arduino IDE 1.8.9 with the latest hardware library update, and I can't even compile the examples without errors. I have the generic ESP8266 selected but I've also tried the WEMOS and the Node MCU 1.0 but no matter which hardware I select, the examples will not compile.

Here are the compiler logs when I try to compile SerialESP8266_tcp_cli with Generic ESP8266 selected:

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/michael/Library/Arduino15/packages -hardware /Users/michael/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/michael/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/michael/Documents/Arduino/libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,ssl=all,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=512K,led=2,sdk=nonosdk221,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -vid-pid=1A86_7523 -ide-version=10809 -build-path /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027 -warnings=all -build-cache /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_cache_782446 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.python.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/python/3.7.2-post1 -prefs=runtime.tools.python-3.7.2-post1.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/python/3.7.2-post1 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-3-20ed2b9.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs-2.5.0-3-20ed2b9.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9 -verbose /Users/michael/Documents/Arduino/libraries/ESP8266wifi2/examples/SerialESP8266_tcp_cli/SerialESP8266_tcp_cli.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/michael/Library/Arduino15/packages -hardware /Users/michael/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/michael/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/michael/Documents/Arduino/libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,ssl=all,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=512K,led=2,sdk=nonosdk221,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -vid-pid=1A86_7523 -ide-version=10809 -build-path /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027 -warnings=all -build-cache /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_cache_782446 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.python.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/python/3.7.2-post1 -prefs=runtime.tools.python-3.7.2-post1.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/python/3.7.2-post1 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-3-20ed2b9.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs-2.5.0-3-20ed2b9.path=/Users/michael/Library/Arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9 -verbose /Users/michael/Documents/Arduino/libraries/ESP8266wifi2/examples/SerialESP8266_tcp_cli/SerialESP8266_tcp_cli.ino
Using board 'generic' from platform in folder: /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2
Using core 'esp8266' from platform in folder: /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2
Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
Detecting libraries used...
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/sketch/SerialESP8266_tcp_cli.ino.cpp -o /dev/null
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/sketch/SerialESP8266_tcp_cli.ino.cpp -o /dev/null
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src -I/Users/michael/Documents/Arduino/libraries/ESP8266wifi2 /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/sketch/SerialESP8266_tcp_cli.ino.cpp -o /dev/null
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src -I/Users/michael/Documents/Arduino/libraries/ESP8266wifi2 /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src/SoftwareSerial.cpp -o /dev/null
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src -I/Users/michael/Documents/Arduino/libraries/ESP8266wifi2 /Users/michael/Documents/Arduino/libraries/ESP8266wifi2/SerialESP8266wifi.cpp -o /dev/null
Generating function prototypes...
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src -I/Users/michael/Documents/Arduino/libraries/ESP8266wifi2 /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/sketch/SerialESP8266_tcp_cli.ino.cpp -o /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/preproc/ctags_target_for_gcc_minus_e.cpp
/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Users/michael/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/lwip2/include -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/core -c -Wall -Wextra -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266 -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/variants/generic -I/Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial/src -I/Users/michael/Documents/Arduino/libraries/ESP8266wifi2 /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/sketch/SerialESP8266_tcp_cli.ino.cpp -o /var/folders/31/wvbpnk3d609fm8x1ppxxxcsr0000gr/T/arduino_build_350027/sketch/SerialESP8266_tcp_cli.ino.cpp.o
/Users/michael/Documents/Arduino/libraries/ESP8266wifi2/examples/SerialESP8266_tcp_cli/SerialESP8266_tcp_cli.ino: In function 'void processCommand(WifiMessage)':
/Users/michael/Documents/Arduino/libraries/ESP8266wifi2/examples/SerialESP8266_tcp_cli/SerialESP8266_tcp_cli.ino:81:8: warning: unused variable 'espBuf' [-Wunused-variable]
   char espBuf[MSG_BUFFER_MAX];
        ^
/Users/michael/Documents/Arduino/libraries/ESP8266wifi2/examples/SerialESP8266_tcp_cli/SerialESP8266_tcp_cli.ino: Assembler messages:
/Users/michael/Documents/Arduino/libraries/ESP8266wifi2/examples/SerialESP8266_tcp_cli/SerialESP8266_tcp_cli.ino:98: Error: unknown opcode or format name 'jmp'
Using library SoftwareSerial at version 5.0.4 in folder: /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/SoftwareSerial 
Using library ESP8266wifi2 in folder: /Users/michael/Documents/Arduino/libraries/ESP8266wifi2 (legacy)
exit status 1
Error compiling for board Generic ESP8266 Module.

Link error

Hi,

I´m working a project using ESP-8266 ESP-01, but when i try connect do a server return Link Error. When I use the AT Commands direct by serial terminal it´s work fine. Any ideias?

The code:

#include <ESP8266wifi.h>
#include <SoftwareSerial.h>

#define SSID "My network"
#define PASSWORD "xxxxxxxxxx"
#define sw_serial_rx_pin 3 // Connect this pin to TX on the esp8266
#define sw_serial_tx_pin 2 // Connect this pin to RX on the esp8266
#define esp8266_reset_pin 8 // Connect this pin to CH_PD on the esp8266, not reset. (let reset be unconnected)

uint8_t wifi_started = false;
SoftwareSerial swSerial(sw_serial_rx_pin, sw_serial_tx_pin);
// the last parameter sets the local echo option for the ESP8266 module..
ESP8266wifi wifi(swSerial, swSerial, esp8266_reset_pin,Serial);

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
swSerial.begin(115200);
Serial.println("Starting wifi...");

wifi.begin();
//wifi.setTransportToTCP();
wifi.connectToAP(SSID, PASSWORD);
if (wifi.isStarted()) Serial.println("Just Testing....");
condicaotempo();
}

void condicaotempo() {
String location = "/"; // Location where to fetch the new Status
String cmd = "GET / HTTP/1.1\r\n"; // complete HTTP request
//cmd += "Host: www.google.com.br\n";

wifi.connectToServer("www.google.com.br", "80");
delay(1000);
wifi.send(SERVER, cmd);

WifiMessage in = wifi.listenForIncomingMessage(2000);
if (in.hasData)
{
Serial.print("Response: ");
Serial.println(in.message);
} else {
Serial.println("I can´t connect to server :-(");
}
wifi.disconnectFromServer();
}

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

}

Thanks for helping

why not work

#include <LiquidCrystal_I2C.h>
#include <DS1302.h>
#include <SoftwareSerial.h>
#include <SD.h>

const int sd_cs = 10;

const int rtc_clk = 6;
const int rtc_dat = 5;
const int rtc_rst = 4;

const int joystick_x = A0;
const int joystick_y = A1;
const int joystick_sw = 3;

const int com_tx = 0;
const int com_rx = 7;
const int com_dtr = 2;
const int com_dtr_led = 9;

//int jostick_x_axix;
//int jostick_y_axix;
//int jostick_sw_state;

const int min_page_num = 1;
const int max_page_num = 2;

SoftwareSerial com(com_rx, com_tx);
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
DS1302 rtc(rtc_rst, rtc_dat, rtc_clk);

void setup()
{
pinMode(joystick_x, INPUT);
pinMode(joystick_y, INPUT);
pinMode(joystick_sw, INPUT);
pinMode(com_dtr, INPUT);
pinMode(com_dtr_led, OUTPUT);

//joystick_x_axix = map(analogRead(joystick_x), 0, 1023, 0, 100);
//joystick_y_axix = map(analogRead(joystick_y), 0, 1023, -50, 50);
//joystick_sw_state = digitalRead(joystick_sw);

digitalWrite(com_dtr_led, HIGH);

rtc.halt(false);
rtc.writeProtect(false);

lcd.begin(16, 2);
com.begin(115200);
Serial.begin(9600);

if(digitalRead(com_dtr) == HIGH)
{
digitalWrite(com_dtr_led, HIGH);
}

rtc_setup(2019, 02, 03, 17, 00, 00, SUNDAY); //comment this line out if you are uploaded the code once
}

void loop()
{
int joystick_x_axix = map(analogRead(joystick_x), 0, 1023, 0, 100);
int joystick_y_axix = map(analogRead(joystick_y), 0, 1023, -50, 50);
int joystick_sw_state = digitalRead(joystick_sw);

int page_num = 1;

if(joystick_x_axix >= 10)
{
if(!page_num > max_page_num)
{
page_num++;
}
else
{
page_num = min_page_num;
}
}
else if(joystick_x_axix <= -10)
{
if(!page_num < min_page_num)
{
page_num--;
}
else
{
page_num = max_page_num;
}
}

switch(page_num)
{
case 1:
lcd.clear();
lcd.setCursor(4, 0);
lcd.print(rtc.getTimeStr());

  // Display abbreviated Day-of-Week in the lower left corner
  lcd.setCursor(0, 1);
  lcd.print(rtc.getDOWStr(FORMAT_SHORT));
  
  // Display date in the lower right corner
  lcd.setCursor(6, 1);
  lcd.print(rtc.getDateStr());

  // Wait one second before repeating :)
  delay (1000);
  break;
  
case 2:
  lcd.setCursor(0, 0);
  lcd.print("test");
  break;

}
}

void rtc_setup(int yr, int mnth, int dy, int hr, int mnt, int scnd, int dyow)
{
rtc.setDOW(dyow); // Set Day-of-Week to FRIDAY
rtc.setTime(hr, mnt, scnd); // Set the time to 12:00:00 (24hr format)
rtc.setDate(dy, mnth, yr); // Set the date to August 6th, 2010
}

bigproj.zip

AT+CIPSTART link type error

Hi,
i am using the SerialESP8266wifi.h library with Arduino UNO and ESP8266 module.
I uploaded the library example sketch into the Arduino.
I got link to WiFi network and got IP address just fine. also i ping it and got response.
While i'm trying to connect to server using connectToServer, i am receiving a message - Link Type Error in the serial monitor.
I succeeded to conect to the server same IP and Port using Hyper Terminal but still got the Error from the ESP8266 and Arduino.

any suggestions?
thanks in advanced.

arduino 1.6.7 compile error

C:\Users\mollo\Documents\Arduino\libraries\ESP8266wifi-master\ESP8266wifi.h:175:10: note: no known conversion for argument 2 from 'STATUS' to 'const char*'

HTTP request, returns 'garbage'.

I do not know, if it's an serious issue (or it's just my fault ;) ). But I am having some "trouble" with this Arduino library.

Currently I am using the ESP8266 as connection method to a local server, running Apache. The HTTP response I get back from my determines if a connected LED is turned off or on. Based on the "true" or "false" HTTP response.

The problem I am having is that the HTTP response I am getting isn't complete and garbled. The code I am using to send the HTTP request is as followed:

  String location = "/home-automation/status.php?action=get&light=kitchen"; // Location where to fetch the new Status
  String cmd = "GET " + location + " HTTP/1.1\r\n"; // complete HTTP request
  cmd += "Host: 10.13.37.153\n";


  wifi.connectToServer("10.13.37.153", "80");
  if (wifi.isConnectedToServer())
  {
    Serial.println("I am connected to the server");

    wifi.send(SERVER, cmd);

    WifiMessage in = wifi.listenForIncomingMessage(2000);
    if (in.hasData)
    {
      Serial.print("Response: ");
      Serial.println(in.message);
   }

I already changed the msgIn[] value to a value of 500, that does increase the amount of char's I get back, but still doesn't un-garble the return data.

OUTPUT with debugging

IPD,HTTP/1.1 ��2����0����0��� OK
Date: Sun, 03 May 2015 16:18:59 GMT
Server: Apache/2.4.10 (Debian)
Content-Length: 5
Content-Type: text/plain;charset=UTF-8

false

Output without debugging

HTTP�/1.1� 20�0 OK�
Da�te: �Sun�, 03� May� 20�15 1�6:27�:09 �GMT�
Se�rver�: Ap�ach�e/2.�4.10� (D�ebian�)
�Cont�ent-�Leng�th:� 5
�Cont�ent�-Typ�e: t�

Expected output

HTTP/1.1 200 OK
Date: Sun, 03 May 2015 16:18:59 GMT
Server: Apache/2.4.10 (Debian)
Content-Length: 5
Content-Type: text/plain;charset=UTF-8

false

Additional info: I've connected the ESP8266 to an Arduino UNO using the SoftwareSerial on pins DIGITAL pins 8 and 9.

getIP

Does the getIP function show the IP of the device or the IP of the server it is connected to?

Disable multiple connections

I had to make some adjustments to ESP8266wfi get my ESP-01 (0.9.5/0.2.1) to connect successfully to an external server.

line 33: const char CIPSTART[] PROGMEM = "AT+CIPSTART=\"";
line 34: `const char CIPCLOSE[] PROGMEM = "AT+CIPCLOSE";``

add const char CIPMUX_0[] PROGMEM = "AT+CIPMUX=0";

change line 144 to writeCommand(CIPMUX_0, EOL);

change line 233 to writeCommand(CIPCLOSE, EOL);

I don't know why by I get a "link typ ERROR" when communicating over channel 4.

SerialESP8266wifi.h Listen to Incoming Message

Hi,
using listenForIncomingMessage(timeOut) enable receiving messages from client.
it seems that all message are "head trim" - first character is cut by the method.
e.g - if client sent "Hello World", the Arduino is showing "ello World".
is it a bug in library?
am i doing something wrong?

thanks

odd-ball delays?

Hi-ho,
Firstly thanks for your work on this library, I was having debugging issues with a library of my own for a small project and couldn't see the wood for the trees!

But... What's with the odd-ball delays? You've called it niceDelay() and I can understand using millis() if you're releasing control back to loop() for multi-tasking, but, well... I don't get it. :-)

can this library be used with arduino due

Hello I just want to know if this library can work with arduino due I tried but i think there's something wrong when I modified the example to work with due if I am not mistaken I got an error with jmp 0
( don't remember exactly cuz I am away right now from my PC once I get back I will post the error )
I changed from softserial to serial3 and changed the baud to the required one but when I compile I get an error but when I compile for mega or uno (using softserial) I get no error

UDP

Can you give an example code about udp

Do I need software serial? I'm using megaboard. I'm using hardware serial. How do I configure?

UDP establishing connection, getting connection confirmation, learning ip address, receiving messages, sending messages

can you give a short example

THANK YOU SO MUCH

upolad to ESP8266

Hello community,

in the section describing this library, the author said that this library is tested with ESP8266 module with Firmware 0.9.2.4

does that mean that the Programm compiled by arduino IDE 1.6.0 could be uploaded to the Module directy? I mean i don't Need to upload it to an atmega328p or other arduino board?

If so i can not upload it directly to the module! have you did that before?

thnx.

can't stop client when client isn't receive data

I was run server on Wemos D1 mini, when ESP transmit TCP packet, and client isn't received, the ESP was hanged, and only reset help. Who know how to check while "client.printing" is the client available yet or not?
the Code below

#include <ESP8266WiFi.h>

const char* ssid = "my_network";
const char* password = "mynetpass";

WiFiServer server(80);
void setup() {
  Serial.begin(115200);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while(WiFi.status() != WL_CONNECTED){
    delay(500);
    Serial.print(". ");
  }
  Serial.println();
  Serial.println("WiFi connected");
  Serial.println(WiFi.localIP());
  server.begin();
  Serial.println("Server started");
}
WiFiClient client;
unsigned long angam=0;
unsigned long jam[2]; // debug
// unsigned long jam;
void loop() {
  jam[0] = millis();//debug
  //jam = millis();
  client = server.available();
  if(!client){
    return;
  }
  jam[1] = millis(); // debug
  Serial.println("server is available"); // debug
  angam++;
  Serial.println();
  Serial.println();
  Serial.println();
  while(!client.available()){
    delay(1);
    if(millis() - jam[1] > 5000) return;
  }
  Serial.print("client is available  "); //debug
  Serial.println(millis() - jam[1]); //debug
  Serial.print(client.remoteIP());
  Serial.println("   " + client.readStringUntil('\r'));
  Serial.println("start flush"); //debug
  jam[1] = millis(); //debug
  client.flush();
  Serial.print("flush end  "); //debug
  Serial.println(millis() - jam[1]); //debug
  Serial.println("Start client print  "); //debug
  client.print("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html>");
  client.print("Server is ready " + String(angam) + "\n");
  client.print("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, ");
  client.print("</html>\n");
  Serial.println("Client print succesfull");
  Serial.println(millis() - jam[0]); //debug
  //Serial.println(millis() - jam); 
}

Issues Using this library with Arduino Mega, compatibility?

I've been having troubles using an Arduino Mega and several types of ESP8266 such as ESP-01, ESP-03 and ESP-12.
I'll list the problems I had:

    1. The echo function doesn't work, I can't see in the serial monitor "Serial" what is sent or received on swSerial.
  1. The HW reset function resets all the time (each 3 seconds) the ESP8266
  2. The connectToServer function is trying to connect over and over again even when it returns ALREADY CONNECTED, we actually changed the .cpp file so it matches: const char ALREADY[] PROGMEM = "ALREADY CONNECTED" but it still try to reconnect

Is it because I'm using an arduino mega which is not ATMEGA328 based or what could it be?
I'd appreciate some help!

Question: HTTP wrappers

Hi @ekstrand, thanks for your great library.

Is there any known wrappers to support HTTP stuff over ESP8266wifi library? I mean it would be great to use such a functions like below

HttpRequest req = new HttpRequest();
req.setUrl("hello/world");
req.setHeader("Accpet-Encodings", "gzip")
wifi.send(SERVER, req);

instead of low-level Strings manipulation to build http request message manually.

Thank you in advance!

library.json is corrupt

... \xe2\x80\x9dSerialESP8266wifi" ...
That's some sort of unicode smart quote nonsense, please change it to a "

It's breaking my platform.io build

Thanks!

Wrong names and links

Hi,
As I understand, old project name was SerialESP8266wifi, but now project was renamed to ESP8266wifi. So in MD file was no those changes. Please replase all old words to new one in README.md file. The big problem, that link for ZIP file is broken.

Error compiling - missing "min"

  1. Not Compile. See abore errors.
  2. Can I have one example of costructor, hardware serial and no reset connectet ?

Arduino:1.7.11 (Windows 7), Scheda:"Arduino M0"

D:\Documents\Arduino\libraries\ESP8266wifi-master\ESP8266wifi.cpp: In member function 'WifiMessage ESP8266wifi::listenForIncomingMessage(int)':

D:\Documents\Arduino\libraries\ESP8266wifi-master\ESP8266wifi.cpp:547:60: error: 'min' was not declared in this scope

     readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));

                                                        ^

D:\Documents\Arduino\libraries\ESP8266wifi-master\ESP8266wifi.cpp: In member function 'WifiMessage ESP8266wifi::getIncomingMessage()':

D:\Documents\Arduino\libraries\ESP8266wifi-master\ESP8266wifi.cpp:584:60: error: 'min' was not declared in this scope

     readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));

                                                        ^

Errore durante la compilazione

Questo report potrebbe essere più ricco
di informazioni con
"Mostra un output dettagliato durante la compilazione"
abilitato in "File > Impostazioni"

Anomole

This is not an issue more than a curiosity.

I use these two lines at the start of many of my Arduino and ESP sketches to turn Serial.print on or off with one #define statement.:

#define DEBUG true  //set to true for debug output, false for no debug output
#define Serial if(DEBUG)Serial

It works. Except when I add #include <ESP8266WiFi.h>. I then get a compile error:

expected primary-expression before 'if'
It's not a show-stopper because the "feature" is simply a convenience, but examining the cpp code in the library is a bit above my skill level. I am simply curious what is in the ESP8266WiFi.h that would prevent me using the debug lines?

Redeclaration of symbols When compiling

When i try to compile any code with SerialESP8266Wifi.h included It tries to redeclare all the Symbols that are at the start of SerialESP8266Wifi.cpp.

.pio\libdeps\esp01_1m\SerialESP8266wifi\SerialESP8266wifi.cpp:15:57: error: 'const char OK []' redeclared as different kind of symbol
#define PROGMEM attribute((section(".progmem.data")))
This happens with every Single constant in the file

I've tried it in both arduino Studio and PlatformIO it has the same error in both of them

Problem with avr/pgmspace.h

I'm trying to compile some code with PlatformIO and I'm getting this error:

Compiling .pioenvs/nodemcuv2/src/EnviroMonitorStation.ino.o
Compiling .pioenvs/nodemcuv2/src/EnviroMonitorStation.ino.o
Compiling .pioenvs/nodemcuv2/lib/ESP8266wifi_ID1101/ESP8266wifi.o
Compiling .pioenvs/nodemcuv2/lib/ESP8266wifi_ID1101/ESP8266wifi.o
In file included from .piolibdeps/ESP8266wifi_ID1101/ESP8266wifi.cpp:9:0:
.piolibdeps/ESP8266wifi_ID1101/ESP8266wifi.h:23:26: fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>
^
compilation terminated.

I found this esp8266/Arduino#2366

I think it might be related. Is there anything I could do to allow compilation?

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.