插上开发板后查看,在设备管理器中查看端口(Windows+R 输入devmgmt.msc),如果未识别需要下载安装驱动,记住这里的端口号(如:COM3).
打开命令行依次执行
(1) 安装esptool 输入:
pip install esptool
esptool.py --port COM3 erase_flash
esptool.py --port COM3 --baud 115200 write_flash -z 0x1000 C:\esp32-20171102-v1.9.2-443-g236297f4.bin --verify
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')
For further help on a specific object, type help(obj)
For a list of available modules, type help('modules')
help('modules')
main framebuf re upip
_boot gc select upip_utarfile
_onewire hashlib socket upysh
_thread heapq ssl urandom
apa106 inisetup struct ure
array io sys urequests
binascii json time uselect
btree machine ubinascii usocket
builtins math ucollections ussl
cmath micropython uctypes ustruct
collections neopixel uerrno utime
dht network uhashlib utimeq
ds18x20 ntptime uheapq uzlib
errno onewire uio zlib
esp os ujson
flashbdev random uos
Plus any modules on the filesystem
help(network)
object <module 'network'> is of type module
name -- network
init -- <function>
WLAN -- <function>
LAN -- <function>
phy_mode -- <function>
STA_IF -- 0
AP_IF -- 1
MODE_11B -- 1
MODE_11G -- 2
MODE_11N -- 4
AUTH_OPEN -- 0
AUTH_WEP -- 1
AUTH_WPA_PSK -- 2
AUTH_WPA2_PSK -- 3
AUTH_WPA_WPA2_PSK -- 4
AUTH_MAX -- 6
PHY_LAN8720 -- 0
PHY_TLK110 -- 1
I2C总线是由Philips公司开发的一种简单、双向二线制同步串行总线。它只需要两根线即可在连接于总线上的器件之间传送信息。
Arduino-ESP32项目提供的Preferences库是一个专为ESP32设计的非易失性存储解决方案,它替代了传统的Arduino EEPROM库,提供了更强大、更可靠的数据存储功能。
本方案是一个基于ESP32-CAM + 物联网的图像采集方案。
ESP32-CAM与MicroPython结合可实现摄像头图像采集、视频流传输等功能,不过Micropython官方没有支持ESP32-CAM的固件,需要烧录第三方的专有固件。
相信很多人都有把绿植给养死的经历,可能是浇水过多、忘记浇水、较长时间不在家不能浇水等,本文介绍一种可以灵活定制的智能浇花方案。
MicroPython 在 ESP32 上支持线程(Thread)功能,通过_thread模块实现。线程允许程序并发执行多个任务,适合处理需要同时运行的场景,例如传感器数据采集和网络通信。
掌控板3.0升级了主控,还主打AI。带有双麦克风阵列,增加了音频解码芯片,板载了一个1W喇叭,还把之前的单色屏幕换成了1.47寸的彩色屏幕,有更多的可玩性。
使用了 MicroPython 库,通过 定时器(Timer) 和 ADC(模数转换器) 功能来实时读取传感器数据。使用定时器可以实现高精度、非阻塞、低资源消耗的周期性任务,保证实时性和可靠性,特别适用于嵌入式系统中的多任务处理和低功耗场景。
ESP32的DAC函数可以实现真正的模拟输出。
ESP32 没有Arduino输出 PWM 的 analogWrite(pin, value) 方法,取而代之的 ESP32 有一个 LEDC 来实现PWM功能。
machine.pwm是MicroPython中用于控制PWM输出的模块之一,它提供了一些方法和属性,用于设置和控制PWM输出的频率、占空比等参数,从而实现对各种应用场景的控制。