探究ESP32S【第二天】——连接wifi(2)

先敲个help(),ESP32里面到底有哪些,help一下:

Welcome to MicroPython on the ESP32!

For generic online docs please visit http://docs.micropython.org/

For access to the hardware use the 'machine' module:

import machine

pin12 = machine.Pin(12, machine.Pin.OUT)

pin12.value(1)

pin13 = machine.Pin(13, machine.Pin.IN, machine.Pin.PULL_UP)

print(pin13.value())

i2c = machine.I2C(scl=machine.Pin(21), sda=machine.Pin(22))

i2c.scan()

i2c.writeto(addr, b'1234')

i2c.readfrom(addr, 4)

Basic WiFi configuration:

import network

sta_if = network.WLAN(network.STA_IF); sta_if.active(True)

sta_if.scan() # Scan for available access points

sta_if.connect("<AP_name>", "<password>") # Connect to an AP

sta_if.isconnected() # Check for successful connection

Control commands:

CTRL-A -- on a blank line, enter raw REPL mode

CTRL-B -- on a blank line, enter normal REPL mode

CTRL-C -- interrupt a running program

CTRL-D -- on a blank line, do a soft reset of the board

CTRL-E -- on a blank line, enter paste mode

For further help on a specific object, type help(obj)

For a list of available modules, type help('modules')

看看还有哪些模块,help('modules')

今天生病了,时间不够,那么就完善一下当前的连接wifi的代码

拉闸,好像mircopython对字符串不太友好,并不想python那么自如。

明天用正则表达式试一下

猜你喜欢

转载自blog.csdn.net/zhangyufeikk/article/details/93464197
今日推荐