37. Lektion: Request: Difference between revisions
Jump to navigation
Jump to search
| Line 24: | Line 24: | ||
Anwendung: | Anwendung: | ||
<pre> | <pre> | ||
import wlantools as wl | >>> import wlantools as wl | ||
network config: ('192.168.5.120', '255.255.255.0', '192.168.5.1', '192.168.5.1') | network config: ('192.168.5.120', '255.255.255.0', '192.168.5.1', '192.168.5.1') | ||
>>> wl.wlan.ifconfig()[0] | >>> wl.wlan.ifconfig()[0] | ||
Revision as of 23:57, 31 December 2023
Webserver ansprechen
Zur einfacheren Verbindung mit dem Wlan gibt es das Modul wlantools:
# wlantools.py
#
# Modul mit Funktionen zum Wlan.
#
import network
# Wlan Verbindung herstellen
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network...')
wlan.connect(SSID, PW)
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
Anwendung:
>>> import wlantools as wl
network config: ('192.168.5.120', '255.255.255.0', '192.168.5.1', '192.168.5.1')
>>> wl.wlan.ifconfig()[0]
'192.168.5.120'
Links:
- Wetter-API
Zurück zur "Micropython Kurs 2023 Teil 2" Startseite
Zurück zur "Micropython Kurs 2023" Startseite
Zurück zur Programmieren Startseite
Zurück zur Wiki Startseite