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

博客介绍了在ESP32上使用MicroPython的相关操作,包括通过help命令查看信息、使用machine模块访问硬件、进行基本WiFi配置等,还提及MicroPython对字符串处理不如Python自如,后续打算用正则表达式完善连接WiFi代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

先敲个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那么自如。

明天用正则表达式试一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值