Merry christmas everyone. I have a present for you.
A sketch with a simple modified webserver for the ESP8266 AT firmware using an arduino. Most credits go to this guy, where i got the basics : http://rayshobby.net/?p=9734 .
What my sketch basically does you might ask?
Well, it first boots up as an AP (access point), you connect to it (just like you connect to your wifi, it should be named something like ESP-???) and access in your browser 192.168.4.1. Here you will see a very simple webpage where you enter the SSID and password of your wifi network, and then it connects to it. After this you can do all sort of things. In this sketch it just shows the same webpage again.
I did this to learn how to use forms with GET method to send and receive data (to fiddle with sensors, use it to turn LEDs on and off, etc).
I won’t post here the full code because i will upload the file and you can also find the simple webserv on rayshobby.
The function “get_data” is very simple and reads what comes out after the /get request. Ignore if it request the favicon.ico (very annoying, chrome sends a request for every refresh of the page – arrrhh), simple display the website if it’s a simple “/get” as if you are accessing the webserver, and if there is a question mark character store the data using the sort_data function. (if you input data and press connect, i will have to add to check if the strings are empty, or if it connects successfuly, this is just a basic sketch)
Please modify the port if u want (but you will have to access the ESP like 192.168.4.1:PORT) and the baud rate. You need to update firmware to be able to change baud rate. I use this one.
I will post a simple tutorial about how to simply turn a led ON or OFF soon but if you understand the code, it should be simple enough. Enjoy!
Download the arduino sketch.