This project helps you to get any sensor data from esp8266 to python as a variable and control the module through python without AT commands.
It helps you to pull data from esp8266 and command it trough py. Tutorial here.
Python 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.