-->
Page 1 of 1

ESP01 + Arduino + ESP8266 Simple Library, no IP showing

PostPosted: Sun Jan 17, 2016 5:31 pm
by domiflichi
Hello,

I'm having an issue with my ESP01+Arduino+Logic Level Converter+ESP8266 Simple library not showing me it's IP address in the serial monitor. However, I know it's getting one because I can see it in my WiFi controller's software 'Client' list and I can ping it.

Using Arduino IDE 1.6.5, and the output of the serial monitor is:



ESP8266 Demo Sketch
Reset: OK
Connect: OK
IP Address: 0.0.0.0

The string IP is: 0.0.0.0
The unsigned long IP is: 0
The IP address 127.0.0.1 has integer value 2130706433
The integer value 921773419 has IP address 54.241.37.107
End of Demo

The string IP is: 0.0.0.0
The unsigned long IP is: 0
The IP address 127.0.0.1 has integer value 2130706433
The integer value 921773419 has IP address 54.241.37.107
End of Demo

The string IP is: 0.0.0.0
The unsigned long IP is: 0
The IP address 127.0.0.1 has integer value 2130706433
The integer value 921773419 has IP address 54.241.37.107
End of Demo


and it goes on and on and on, etc.

The code:

Code: Select all/**
 * Copyright (C) 2014 James Sleeman
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @author James Sleeman, http://sparks.gogo.co.nz/
 * @license MIT License
 */


#include <Arduino.h>
#include <SoftwareSerial.h>
#include <ESP8266_Simple.h>

// These are the SSID and PASSWORD to connect to your Wifi Network
#define ESP8266_SSID  "SSIDHERE"
#define ESP8266_PASS  "PASSWORDHERE"

ESP8266_Simple wifi(8,9);

// See HelloWorld example for further comments.

void setup()

  Serial.begin(9600); // Reduce this if your Arduino has trouble talking so fast
  Serial.println("ESP8266 Demo Sketch");

  wifi.begin(9600); 
  wifi.setupAsWifiStation(ESP8266_SSID, ESP8266_PASS, &Serial);   
 
  // A blank line just for debug formatting
  Serial.println();
}

void loop()
{
 
  // This example is just to show you how to grab the IP address of your
  //  device after it has connected, in case you want to do something with
  //  it.
 
  // You can get it either as a 16 byte string, or as a long unsigned integer
  // representation. 
 
  char          ipAddressString[16]; // 16 bytes needed
  unsigned long ipAddressLong;       // only 4 bytes needed
 
  // Either way, you get the address exactly the same.
  wifi.getIPAddress(ipAddressString);
  wifi.getIPAddress(ipAddressLong);
 
  // And then do what you like with it.
  Serial.print("The string IP is: ");
  Serial.println(ipAddressString); 
  Serial.print("The unsigned long IP is: ");
  Serial.println(ipAddressLong);
 
  // You can convert from one to the other
  strcpy(ipAddressString,"127.0.0.1");   
  wifi.ipConvertDatatypeFromTo(ipAddressString,ipAddressLong); 
  Serial.print("The IP address ");      Serial.print(ipAddressString);
  Serial.print(" has integer value ");  Serial.println(ipAddressLong);
 
  ipAddressLong = 0x36F1256B;
  wifi.ipConvertDatatypeFromTo(ipAddressLong,ipAddressString);   
  Serial.print("The integer value ");  Serial.print(ipAddressLong);
  Serial.print(" has IP address ");    Serial.println(ipAddressString);
   
  Serial.println("End of Demo"); 
  Serial.println();
  delay(5000); 
}


This is not my sketch...I just downloaded it from: https://github.com/sleemanj/ESP8266_Simple and put in my own WiFi SSID and password of course.

As far as the hardware goes, I have it hooked up pretty much as shown in this video:
https://youtu.be/VDfI546YThQ?t=47s

Using an official (as opposed to a clone) older Arduino Duemilanove, Sparkfun's official Logic Level Converter Bi-Directional, and an ESP8266 ESP-01 that I recently purchased from eBay.

I'm not sure how much more info is needed, so just let me know whatever else I need to post (I didn't want to create a huge post with too much unnecessary info).

Re: ESP01 + Arduino + ESP8266 Simple Library, no IP showing

PostPosted: Sat Jan 30, 2016 3:56 pm
by domiflichi
Ok, I found the problem, so for anyone else who may be interested:

Basically, there's been changes in the ESP8266's firmware (naturally and good, right?). But the problem is that among these things that changed is format of the response that it gives when you query it for the device's own IP address. The author of the ESP8266_Simple library hasn't had a chance to update it yet. Simple as that.

That's all mentioned in his Readme file, but I somehow missed it the first time I read it.

Hope this helps someone!