Outils pour utilisateurs

Outils du site


esp8266:micropython

Différences

Ci-dessous, les différences entre deux révisions de la page.


esp8266:micropython [2024/02/09 17:10] (Version actuelle) – créée - modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +====== Micropython sur ESP8266 ======
 +suivre https://github.com/micropython/micropython/tree/master/esp8266 pour fabriquer le firmware...
  
 +pistes:
 +  * http://forum.micropython.org/viewtopic.php?t=1655
 +  * http://www.electrodragon.com/w/MicroPython_ESP8266
 +  * https://learn.adafruit.com/building-and-running-micropython-on-the-esp8266/micropython-usage
 +et 
 +  * de http://docs.micropython.org/en/latest/esp8266/esp8266/quickref.html
 +<code>
 +import network
 +
 +wlan = network.WLAN(network.STA_IF) # create station interface
 +wlan.active(True)       # activate the interface
 +wlan.scan()             # scan for access points
 +wlan.isconnected()      # check if the station is connected to an AP
 +wlan.connect('essid', 'password') # connect to an AP
 +wlan.mac()              # get the interface's MAC adddress
 +wlan.ifconfig()         # get the interface's IP/netmask/gw/DNS addresses
 +
 +ap = network.WLAN(network.AP_IF) # create access-point interface
 +ap.active(True)         # activate the interface
 +ap.config(essid='ESP-AP') # set the ESSID of the access point
 +
 +</code>
 +<code>
 +def do_connect():
 +    import network
 +    wlan = network.WLAN(network.STA_IF)
 +    wlan.active(True)
 +    if not wlan.isconnected():
 +        print('connecting to network...')
 +        wlan.connect('essid', 'password')
 +        while not wlan.isconnected():
 +            pass
 +    print('network config:', wlan.ifconfig())
 +</code>