In this example we are using ESP8266 wifi module and OLED display, to display location using your IP address. We will hit the URL idiotware.herokuapp.com and ask this “getCityCountryByIP” to get Country and city name.
- In this Code we have used ELClient.h library to get data from “
idiotware.herokuapp.com
" and "U8glib.h
" to display this information on OLED display.
u8g.drawStr(1,20,"Where am I ??")
is used to display text on OLED
- The function get_Location() will get you the Country and City using ESP8266 IP address.
- Once we get the City and Country we will display this using following line
u8g.print(countryCode)
andu8g.print(city)
.
You will need to upload esp link firmware to esp8266-01 module to configure wifi ssid and password. Visit this link for more information: https://github.com/jeelabs/esp-link
Once you upload the code you will see the oled display showing the current location with city and country name.
For example:
The Arduino sends request only one time after power, If you find that OLED is still showing searching, please reset the Arduino. This will send another request to the idiotware.herokuapp.com for getting IP address.
Now you have your own location tracking device that show's your location by IP address. No more connecting things to breadboard and messy wiring. With the Idiotware shield the sky's the limit.
Comments