*** Just add 2~3 lines, then your MCU (ESP8266 or ESP32) can be a gateway of your IoT enabled devices ***
*** MyWifi is a library I designed for a MCU to either connect your WiFi in STA mode or play a role as a WiFi AP in the easiest and fastest way.
Step 1: Upload library to your MCU
First, download the library by its link and upload it to your MCU !
- MyWifi: A basic library for WiFi connection
*** If no idea how to upload files to your MCU board, you can read my other article “So Easy — ESP8266/ESP32 File Management” first. ***
Step 2: My some demos
Example 1 — Nearby WiFi AP Scanner
from MyWifi import myWifi
my = myWifi()
print(my.scan())
Example 2: Let your MCU connect to a WiFi AP
from MyWifi import myWifi
my = myWifi(YOUR_WIFI_SSID, YOUR_WIFI_PWD)
my.connect()
Example 3: Make your MCU play as a WiFi AP
from MyWifi import myWifiAP
my = myWifiAP('ESPxx_AP', '*123456789*')
my.start()
*** The IP of MCU AP is default to 192.168.4.1 ***
Example 4: Try and connect to your MCU AP
As you can see, my mobile has connected to ESPxx_AP (MCU’s AP SSID), and also the information of MCU AP connection displayed.
That’s all, so easy right ? Hope this helps !
Posted by Yungger
If it really help you, you are welcome to clap your hands clicking on top-left icon, or want to buy me a coffee to encourage me to write more, I thank you too 😘 😘 !!