It helps you to pull data from esp8266 and command it trough py. Tutorial here.
Python lib:
- urllib.request (generally internal lib)
Arduino lib:
Different visual version if you didn't understand.
Just import ESP_MICRO.h
and use send / control / return functions for your project.
You simply enter your wifi details into this function and it starts the connection.
It's just a time block that waits for a request. It gives you the full control over python. With this ESP will wait until a python request come.
Finally, you can return the desired data (or simply sensor data) to localhost server.
In order to command ESP trough py we also have a string returning function getPath()
, it simply reads get request:
Useful with interacting and controlling the system.
py: GET example.com/OPEN_LED esp: if (getPath()=="/OPEN_LED"){ digitalWrite(LED,HIGH); }
While uploading the code, check serial port for ESP's local IP if you don't know how to use nmap or obtain ESP's IP, it'll be printed.
- It's fork of mDNSserver example by Ivan Grokhotkov
The code is a bit complex, will be simplified.- ~~Needs a tutorial ~~ (Tutorial here)