Ihr ESP32-MicroPython-Board in 20 Sekunden mit Ihrem WLAN verbinden
English
Deutsch
Haben Sie MicroPython noch nicht auf Ihr ESP32-Board geflasht? Siehe MicroPython in 30 Sekunden auf Ihr ESP32-Board flashen
Kopieren Sie dieses Skript und geben Sie Ihre WLAN-Zugangsdaten ein:
esp32_connect_example.py
import network
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect("YourWifiName", "EnterYourWifiPasswordHere")Nun müssen Sie ein REPL zu MicroPython über USB öffnen.
Wenn Ihr WLAN in Reichweite des Boards ist und das Passwort korrekt ist, sollten Sie eine Ausgabe wie
esp32_repl_output.txt
>>> import network
>>> station = network.WLAN(network.STA_IF)
I (457700) wifi: wifi driver task: 3ffd2a80, prio:23, stack:3584, core=0
I (459702) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (459712) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (459832) wifi: wifi firmware version: 10f4364
I (459832) wifi: config NVS flash: enabled
I (459832) wifi: config nano formating: disabled
I (459832) wifi: Init dynamic tx buffer num: 32
I (459842) wifi: Init data frame dynamic rx buffer num: 32
I (459842) wifi: Init management frame dynamic rx buffer num: 32
I (459852) wifi: Init management short buffer num: 32
I (459852) wifi: Init static rx buffer size: 1600
I (459862) wifi: Init static rx buffer num: 10
I (459862) wifi: Init dynamic rx buffer num: 32
>>> station.active(True)
W (459872) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
I (460012) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 2
I (460062) wifi: mode : sta (24:6f:28:b0:28:b4)
True
I (460062) wifi: STA_START
>>> station.connect("MyWifi", "ThisIsMyWifiPassword")
>>> I (461782) wifi: new:<5,0>, old:<1,0>, ap:<255,255>, sta:<5,0>, prof:1
I (462632) wifi: state: init -> auth (b0)
I (462632) wifi: state: auth -> assoc (0)
I (462642) wifi: state: assoc -> run (10)
I (462672) wifi: connected with MyWifi, channel 5, BW20, bssid = 9a:c7:44:33:22:11
I (462672) wifi: pm start, type: 1
I (462672) network: CONNECTED
I (463672) tcpip_adapter: sta ip: 192.168.178.42, mask: 255.255.255.0, gw: 192.168.178.1
I (463672) network: GOT_IP
>>>Beachten Sie, dass die Ausgabe einige Sekunden dauern kann, da es einige Zeit dauern kann, sich mit dem Access Point zu verbinden.
Notieren Sie sich die IP-Adresse (192.168.178.42 in diesem Beispiel)
Check out similar posts by category:
Embedded, MicroPython
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow