So Easy MicroPython - My WiFi Connection
by Yungger Chen in Circuits > Microcontrollers
437 Views, 4 Favorites, 0 Comments
So Easy MicroPython - My WiFi Connection
*** Just add 2~3 lines, then your MCU will be an IoT enabled device ***
This is a very useful WiFi library to let your MCU connects to network in easy and fast way.
Upload MyWifi to MCU
Upload the library MyWifi to your MCU first ! [Download MyWifi HERE]
If you have no idea how to do it, read my another article "So Easy - ESP8266/ESP32 File Management" first.
Example 1: Nearby WiFi AP Scanner
from MyWifi import myWifi
my = myWifi()
print(my.scan())
Example 2: MCU Connect to Your AP
from MyWifi import myWifi
my = myWifi('YOUR_WIFI_SSID', 'YOUR_WIFI_PWD')
my.connect()
Example 3: Client Connect to MCU AP
from MyWifi import myWifiAP
my = myWifiAP('ESPxx_AP', '*123456789*') # ('Your Wifi SSID', 'Your Wifi Password')
my.start() # start as an AP
-----
*** The IP of MCU AP is default to 192.168.4.1 ***
Test Your MCU AP Connection
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 So Easy, Hope to Help a Little Bit !
Posted by Yungger
If it help you, and want to give some encouragement, just go HERE 😘 😘 !!