- 2025-01-08
-
回复了主题帖:
24年年终盘点来啦!精选强推:原创、测评、拆解、视频、资料
关注一下
- 2024-11-07
-
回复了主题帖:
【得捷电子Follow me第1期】+ 提交贴
damiaa 发表于 2024-11-6 08:46
不知道这个室内效果如何。
不太行,至少得放窗边
- 2024-08-01
-
回复了主题帖:
【瑞萨RA8D1板卡】 修复板卡按键
nmg 发表于 2024-8-1 08:59
看你接线那里,似乎没有焊盘?
最后是用什么补焊上脱落地方的,没看明白
应该连走线上了,绿油刮掉就行
- 2024-05-29
-
回复了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 显示天气和万年历
wangerxian 发表于 2024-5-29 11:35
json的好用,每天能获取多少次?
今天上去看了眼是每天 1000 次
-
回复了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 显示天气和万年历
wangerxian 发表于 2024-5-28 19:00
和风天气这个API好像很多人获取天气信息都在用。
api 内容相对完备一下,而且提供字体库、天气图标等。就是现在改了返回格式,强制 gzip,以前是可选 json 的,蛋疼
- 2024-05-28
-
发表了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 显示天气和万年历
本帖最后由 ID.LODA 于 2024-5-28 16:55 编辑
## Previously
1. [【FireBeetle 2 ESP32 C6】+ 开箱及更新 Circuitpy 固件](https://bbs.eeworld.com.cn/thread-1281496-1-1.html)
1. [【FireBeetle 2 ESP32 C6 开发板】+ 使用 Web Workflow 开发](https://bbs.eeworld.com.cn/thread-1281597-1-1.html)
1. [【FireBeetle 2 ESP32 C6 开发板】+ 测试使用板载 core modules](https://bbs.eeworld.com.cn/thread-1282655-1-1.html)
1. [【FireBeetle 2 ESP32 C6 开发板】+ 驱动 DFR0664](https://bbs.eeworld.com.cn/thread-1282718-1-1.html)
# 显示万年历和天气
## NTP 网络授时
### 导入 cpy 库
需要从 adafruit-circuitpython-bundle 获取驱动库 adafruit_ntp.mpy, 导入至板卡的 lib 目录
### 示例代码
服务器选择了 `ntp.aliyun.com`
```python
# SPDX-FileCopyrightText: 2024 id.loda
# SPDX-License-Identifier: MIT
import board
import digitalio
import rtc
import time
import wifi
import socketpool
import adafruit_ntp
UTC_OFFSET = 8
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
# code handler
while not wifi.radio.ipv4_address:
try:
print("Connecting to WiFi")
# connect to your SSID
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))
except ConnectionError as e:
print("connect error:{}, retry in 2s".format(e))
time.sleep(2)
pool = socketpool.SocketPool(wifi.radio)
def ntp_sync_time():
print("Local time before synchronization:%s" % str(time.localtime()))
try:
# ntp = adafruit_ntp.NTP(pool, tz_offset=UTC_OFFSET)
ntp = adafruit_ntp.NTP(pool, server='ntp.aliyun.com', tz_offset=UTC_OFFSET)
# ntp = adafruit_ntp.NTP(pool, server='ntp.ntsc.ac.cn', tz_offset=UTC_OFFSET)
# NOTE: This changes the system time so make sure you aren't assuming that time
# doesn't jump.
rtc.RTC().datetime = ntp.datetime
print("Local time after synchronization: %s" % str(time.localtime()))
except OSError as e:
print("ntp error:{}".format(e))
ntp_sync_time()
while True:
time.sleep(0.5)
led.value = not led.value
```
### 效果展示
## 获取天气
天气服务器使用的是和风天气,调用的 [实时天气接口](https://dev.qweather.com/docs/api/weather/weather-now/),需要注意的是返回结果是 gzip 格式,可以使用自带的 ``zlib`` 模块进行解密
返回数据格式如下:
### 示例代码
在和风天气官网注册申请 Key,替换代码中的 **QWEATHER_KEY**
```python
# SPDX-FileCopyrightText: 2024 id.loda
# SPDX-License-Identifier: MIT
import board
import digitalio
import time
import wifi
import socketpool
import ssl
import adafruit_requests
import zlib
import json
QWEATHER_KEY = "Your-Key"
CITYID = '101020100'
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
# code handler
while not wifi.radio.ipv4_address:
try:
print("Connecting to WiFi")
# connect to your SSID
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))
except ConnectionError as e:
print("connect error:{}, retry in 2s".format(e))
time.sleep(2)
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
def qweather_decompress(data):
FTEXT = 1
FHCRC = 2
FEXTRA = 4
FNAME = 8
FCOMMENT = 16
assert data[0] == 0x1f and data[1] == 0x8b
assert data[2] == 8
flg = data[3]
assert flg & 0xe0 == 0
i = 10
if flg & FEXTRA:
i += data[11] = 2:
current_line = ""
break
else:
current_line += char
current_length += char_length
# 添加最后一行
if current_line:
result.append(current_line)
return "\n".join(result)
def display_update_laohuangli(info):
text_yi = split_text(info['yi'], 50)
text_ji = split_text(info['ji'], 50)
lable_laohuangli.text = "农历 {}\n宜 {}\n忌 {}".format(
info['yinli'], text_yi, text_ji)
ntp_sync_time()
display_update_time()
qweather_now_info = qweather_weather_now()
display_update_weather(qweather_now_info)
laohuangli_info = juhe_loahuangli()
display_update_laohuangli(laohuangli_info)
time_update_start = time.time()
# Loop forever so you can enjoy your image
while True:
time.sleep(0.5)
time_current = time.time()
# sync ntp and weather
if time_current - time_update_start >= 2 * 60 * 60:
time_start = time.time_current
ntp_sync_time()
weather_info = qweather_weather_now()
display_update_weather(weather_info)
laohuangli_info = juhe_loahuangli()
display_update_laohuangli(laohuangli_info)
gc.collect()
display_update_time()
# led.value = not led.value
```
### 效果展示
## 总结
circuitpython 提供的 http 请求库 adafruit_requests 使用非常方便,配合内置的 zlib 和 json 模块,对于网络数据的解析非常友好。
-
回复了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 驱动 DFR0664 IPS LCD
Jacktang 发表于 2024-5-24 07:24
应该是可以玩玩从 SD 卡中读取字体库和图片来显示的东西了
可以玩,circuitpython 的库还是比较完善的,我最后示例就是用的 sd 库的图片和字库,很方便
-
回复了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 驱动 DFR0664 IPS LCD
chejm 发表于 2024-5-24 12:26
楼主分享的技术内容非常详实,开阔了眼界,有机会一定实践下
可以,circuitpython 的库还是比较好上手的
- 2024-05-23
-
发表了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 驱动 DFR0664 IPS LCD
## Previously
1. [【FireBeetle 2 ESP32 C6】+ 开箱及更新 Circuitpy 固件](https://bbs.eeworld.com.cn/thread-1281496-1-1.html)
1. [【FireBeetle 2 ESP32 C6 开发板】+ 使用 Web Workflow 开发](https://bbs.eeworld.com.cn/thread-1281597-1-1.html)
1. [【FireBeetle 2 ESP32 C6 开发板】+ 测试使用板载 core modules](https://bbs.eeworld.com.cn/thread-1282655-1-1.html)
# 驱动 DFR0664 TFT 显示屏
[DFR0664 显示屏](https://wiki.dfrobot.com.cn/_SKU_DFR0664_2.0_240x320_LCD) 采用 ST7789V 驱动芯片,其分辨率为320x240,采用 SPI 通信方式,并板载 SD 卡槽,可以轻松的从 SD 卡中读取全彩色位图。模块提供了两种接线方式,一种为普通排针接线方式;另一种为GDI(General Display interface)接口
## 引脚说明
| 标号 | 名称 | 功能描述 |
| ------------ | ------------ | ------------ |
| 1 | VCC | 电源正极 |
| 2 | GND | 电源负极 |
| 3 | SCLK | 时钟 |
| 4 | MOSI | 数据(主机发送从机接收) |
| 5 | MISO | 数据(主机接收从机发送 |
| 6 | CS | 屏幕片选 |
| 7 | RES | 复位 |
| 8 | DC | 数据/命令 |
| 9 | BL | 背光。背光设定了默认值,用户不用连接背光引脚也可点亮;此外,连接背光引脚,输入高电平(1)是将背光亮度调到最大,输入低电平(0)是关闭背光 |
| 10 | SDCS | SD卡片选 |
## CircuitPython Displayio Quickstart
### 导入 cpy 库
需要从 adafruit-circuitpython-bundle 获取驱动库 `adafruit_st7789.mpy` 和 显示库(整个目录) `adafruit_display_text`,导入至板卡的 lib 目录,具体步骤可以参考上一章
### 示例代码
实现了背景及上层画布的绘制和文本的显示。
> 引脚说明
> rst 引脚我没有赋值,因为 GDI 接口连到了板卡的 IO14 引脚,但是 circuitpython 并没有初始化该引脚,所以无法使用
> bl 引脚在 GDI 接口中连到了板卡的 IO15 引脚,和板载 LED 脚位共用,后续使用需要注意一下
```python
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import board
import busio
import terminalio
import displayio
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789
# led = digitalio.DigitalInOut(board.LED)
# led.direction = digitalio.Direction.OUTPUT
# Release any resources currently in use for the displays
displayio.release_displays()
# spi = board.SPI()
spi = busio.SPI(board.D23, MOSI=board.D22, MISO=board.D21)
tft_cs = board.D1
tft_dc = board.D8
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs""", reset=board.D14""")
display = ST7789(display_bus, width=320, height=240, rotation=90)
# Make the display context
splash = displayio.Group()
display.root_group = splash
color_bitmap = displayio.Bitmap(320, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x00FF00 # Bright Green
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
# Draw a smaller inner rectangle
inner_bitmap = displayio.Bitmap(280, 200, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0xAA0088 # Purple
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=20, y=20)
splash.append(inner_sprite)
# Draw a label
text_group = displayio.Group(scale=3, x=57, y=120)
text = "Hello World!"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00)
text_group.append(text_area) # Subgroup for text scaling
splash.append(text_group)
while True:
pass
```
### 效果展示
## 驱动 SD 卡
DFR0664 板载了 SD 卡槽,和 LCD 共用 SPI 驱动
### 导入 cpy 库
需要从 adafruit-circuitpython-bundle 获取驱动库 `adafruit_sdcard.mpy
`,并导入至板卡的 lib 目录
### 示例代码
挂在 SDCard 到 /sd 目录,遍历打印该目录文件
```python
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import os
import time
import board
import digitalio
import displayio
import busio
import sdcardio
import storage
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
displayio.release_displays()
spi = busio.SPI(board.D23, MOSI=board.D22, MISO=board.D21)
sdcard = sdcardio.SDCard(spi, board.D18)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
def print_directory(path, tabs=0):
for file in os.listdir(path):
stats = os.stat(path + "/" + file)
filesize = stats[6]
isdir = stats[0] & 0x4000
if filesize < 1000:
sizestr = str(filesize) + " by"
elif filesize < 1000000:
sizestr = "%0.1f KB" % (filesize / 1000)
else:
sizestr = "%0.1f MB" % (filesize / 1000000)
prettyprintname = ""
for _ in range(tabs):
prettyprintname += " "
prettyprintname += file
if isdir:
prettyprintname += "/"
print('{0:10}'.format(prettyprintname, sizestr))
# recursively print directory contents
if isdir:
print_directory(path + "/" + file, tabs + 1)
print("Files on filesystem:")
print("====================")
print_directory("/sd")
while True:
time.sleep(0.5)
led.value = not led.value
```
### 显示效果
运行之后可以直接通过 web workflow 的文件目录访问,非常方便
## sd 卡导入字库和图片显示
### 导入 cpy 库
需要从 adafruit-circuitpython-bundle 获取图片库 `adafruit_imageload`,字体库 `adafruit_bitmap_font`,并导入至板卡的 lib 目录
### 示例代码
从 sd 卡导入字体库和图片,显示
```python
# SPDX-FileCopyrightText: 2024 id.loda
# SPDX-License-Identifier: MIT
import board
import busio
import digitalio
import displayio
import sdcardio
import storage
import terminalio
import time
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
# rather than a component of the displayio library
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire
from adafruit_display_text import label
from adafruit_st7789 import ST7789
from adafruit_bitmap_font import bitmap_font
import adafruit_imageload
# Release any resources currently in use for the displays
displayio.release_displays()
spi1_bus = busio.SPI(board.D23, MOSI=board.D22, MISO=board.D21)
display_bus = FourWire(spi1_bus, command=board.D8, chip_select=board.D1)
display = ST7789(display_bus, width=320, height=240, rotation=90)
sdcard = sdcardio.SDCard(spi1_bus, board.D18)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
# Make the display context
splash = displayio.Group()
display.root_group = splash
color_bitmap = displayio.Bitmap(320, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x000000 # 0xF8F8FF # Ghost White
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
# 180 * 125
with open("/sd/resources/pic/test_image.png", "rb") as f:
blinka_bitmap, blinka_palette = adafruit_imageload.load(f, bitmap=displayio.Bitmap, palette=displayio.Palette)
blinka_sprite = displayio.TileGrid(blinka_bitmap, pixel_shader=blinka_palette, x=140, y=115)
splash.append(blinka_sprite)
# 160 * 56
with open("/sd/resources/pic/ee.bmp", "rb") as f:
eeworld_bitmap, eeworld_palette = adafruit_imageload.load(f, bitmap=displayio.Bitmap, palette=displayio.Palette)
eeworld_sprite = displayio.TileGrid(eeworld_bitmap, pixel_shader=eeworld_palette, x=0, y=20)
splash.append(eeworld_sprite)
# Set text, font, and color
font = bitmap_font.load_font("/sd/resources/font/opposans_m_12.pcf")
# Create the text label
lable_area_fw = label.Label(
font, x=10, y=96, text="FireBeetle 2 ESP32 C6", scale=1, color= 0x191970
)
lable_area_id = label.Label(
font, x=10, y=128, text="ID.LODA", scale=1, color=(0, 191, 255)
)
splash.append(lable_area_fw)
splash.append(lable_area_id)
while True:
time.sleep(0.5)
# led.value = not led.value
```
### 运行效果
# 总结
circuitpython 提供了比较丰富的库,可以方便的绘制转换需要的资源。但是没有继承类似与 emwin、lvgl 等成熟的图形库。
-
发表了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 测试使用板载 core modules
本帖最后由 ID.LODA 于 2024-5-23 15:05 编辑
# Core Modules 的测试、使用
记上一章使用 Web Workflow 之后开发稳定性提高很多,今天来学习下 circuitpython core modules 的使用
## 查看板载支持的 modules
可以在 repl 或者 code.py 中输入 ``help("modules")`` 即可查看
## microcontroller
处理器模块的接口介绍可以查看以下章节 [microcontroller](https://docs.circuitpython.org/en/latest/shared-bindings/microcontroller/index.html),包含了 unique id、cpu、frequency、temperature 等参数的获取,以及终端复位等的控制
### 示例演示
实现了 cpu 基础信息的获取
```python
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import os
import time
import board
import digitalio
import microcontroller
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
cpu = microcontroller.cpu
print("cpu uid: ", [hex(i) for i in cpu.uid])
print("cpu frequency: ", cpu.frequency)
print("cpu temperature: ", cpu.temperature)
print("cpu voltage: ", cpu.voltage)
print("cpu reset reason: ", cpu.reset_reason)
while True:
time.sleep(0.5)
led.value = not led.value
microcontroller.reset()
```
#### 结果展示
## WIFI
wifi 模块的接口介绍可以查看以下章节 [wifi](https://docs.circuitpython.org/en/latest/shared-bindings/wifi/index.html),该模块为管理 wifi 连接提供了必要的底层功能,以及使用套接字池通过网络进行通信。
### 基础示例
实现了 WIFI 的连接,socket pool 的创建,域名解析以及 ping 包的实现
#### 示例代码
介于我在 settings.toml 里设置了 `CIRCUITPY_WIFI_SSID`、`CIRCUITPY_WIFI_PASSWORD`,通过 os.getenv 可以很方便的获取对应的数据
```python
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import os
import time
import board
import digitalio
import socketpool
import wifi
import ipaddress
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
# code handler
while not wifi.radio.ipv4_address:
try:
print("Connecting to WiFi")
# connect to your SSID
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))
except ConnectionError as e:
print("connect error:{}, retry in 2s".format(e))
time.sleep(2)
pool = socketpool.SocketPool(wifi.radio)
# prints IP address to REPL
print("My IP address is", wifi.radio.ipv4_address)
# prints MAC address to REPL
print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])
# pings eeworld
ip_address = pool.getaddrinfo("eeworld.com.cn", 80)[0][-1][0]
ipv4 = ipaddress.ip_address(ip_address)
print("Ping eeworld.com: %f ms" % (wifi.radio.ping(ipv4)*1000))
while True:
time.sleep(0.5)
led.value = not led.value
```
#### 运行结果
### http 请求示例
进行 http 请求依赖第三方库,可以在 [library 官网](https://circuitpython.org/libraries) 根据对应的版本下载示例包,我这边使用的是 9.x,所以下载的 9.x 版本
#### 导入库
依赖 adafruit_connection_manager.mpy、adafruit_requests.mpy 库,将其导入 lib 目录即可
#### 示例代码
通过请求 https://www.adafruit.com/api/quotes.php,获取网页的内容,并打印
```python
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import os
import time
import ssl
import wifi
import socketpool
import microcontroller
import adafruit_requests
# adafruit quotes URL
quotes_url = "https://www.adafruit.com/api/quotes.php"
# connect to SSID
wifi.radio.connect(os.getenv('CIRCUITPY_WIFI_SSID'), os.getenv('CIRCUITPY_WIFI_PASSWORD'))
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
while True:
try:
# pings adafruit quotes
print("Fetching text from %s" % quotes_url)
# gets the quote from adafruit quotes
response = requests.get(quotes_url)
print("-" * 40)
# prints the response to the REPL
print("Text Response: ", response.text)
print("-" * 40)
response.close()
# delays for 1 minute
time.sleep(60)
# pylint: disable=broad-except
except Exception as e:
print("Error:\n", str(e))
print("Resetting microcontroller in 10 seconds")
time.sleep(10)
microcontroller.reset()
```
#### 运行结果
# 总结
circuitpython 内置了很多功能模块,官网也提供了对应的接口文档,相对还是比较上手使用
- 2024-05-11
-
发表了主题帖:
【FireBeetle 2 ESP32 C6 开发板】+ 使用 Web Workflow 开发
# 搭建 Web Workflow 开发环境
介于 thonny ide 用 repl 连接不是很稳定,尝试使用 Web Workflow 在线开发
## 配置需求
根据官网介绍,将 settings.toml 的文件添加到 CircuitPython 文件系统的根文件夹时,就会启用 Web 工作流,此文件需要包含本地wifi 信息和其他设置。[点击此处了解更多信息](https://docs.circuitpython.org/en/latest/docs/workflows.html#web)。
settings.toml 文件的基本内容如下:
```python
CIRCUITPY_WIFI_SSID = "wifissid"
CIRCUITPY_WIFI_PASSWORD = "wifipassword"
CIRCUITPY_WEB_API_PASSWORD= "webpassword"
```
> 说明
> wifissid 替换为本地 wifi 网络名称
> wifipassword 替换为本地 wifi 网络密码
> webpassword 通过网络浏览器连接到板时使用,设置为任意值
## 导入配置
1. 借助 thonny 工具,连接板卡
1. 打开文件视图,修改 setting.toml 文件
1.
[官网](https://learn.adafruit.com/circuitpython-with-esp32-quick-start/setting-up-web-workflow) 还介绍了通过 repl 的方式,通过命令行写入文件即可。感兴趣的小伙伴可以关注下。
```json
f = open('settings.toml', 'w')
f.write('CIRCUITPY_WIFI_SSID = "wifissid"\n')
f.write('CIRCUITPY_WIFI_PASSWORD = "wifipassword"\n')
f.write('CIRCUITPY_WEB_API_PASSWORD = "webpassword"\n')
f.close()
```
1. 重启看到 ip 地址之后,打开浏览器,使用 MDNS 地址 ``circuitpython.local`` 连接板卡,可以看到欢迎信息,包含了板卡的名称、版本等信息。失败时可以尝试使用 IP 地址打开
1. 点击欢迎页面的 ``full code editer`` 跳转至代码编辑页面,输入 settings.toml 设置的 CIRCUITPY_WEB_API_PASSWORD 密码即可,忽略用户名
1. 现在已经在线编辑器界面,打开文件进行编码
```python
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Example for ESP32-C6. Blinks the built-in LED."""
import time
import board
import digitalio
import wifi
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
print("My MAC addr: %02X:%02X:%02X:%02X:%02X:%02X" % tuple(wifi.radio.mac_address))
print("My IP address is", wifi.radio.ipv4_address)
while True:
led.value = True
time.sleep(0.5)
led.value = False
time.sleep(0.5)
```
1. 保存看到设备打印信息,板载 LED 间断闪烁
# 总结
web workflow 环境配置不是很复杂, 只需在 settings.toml 添加几项内容。而且相比 thonny 来看,修改、保存文件要更加稳定一些,是个不错的选择。
-
发表了主题帖:
【FireBeetle 2 ESP32 C6】+ 开箱及更新 Circuitpy 固件
# 开箱
板卡的包装和之前的 FireBeetle 类型一样比较简单,包含了板卡和排针
正反面
# 简介
FireBeetle 2 ESP32-C6是一款基于ESP32-C6芯片设计的低功耗物联网开发板,适用于智能家居项目。ESP32-C6搭载160MHz的高性能RISC-V 32位处理器,支持Wi-Fi 6、Bluetooth 5、Zigbee 3.0、Thread 1.3通讯协议,可接入多种通讯协议的物联网网络。FireBeetle 2 ESP32-C6支持Type-C、5V DC、太阳能对锂电池进行充电,部署时有更多的供电方式选择。
- 多种传输协议支持,扩展无线连接性
- 支持Wi-Fi 6,实现超低功耗物联网设备
- 优秀的电源系统,设备供电更方便
板卡的详细资源和入门文档可以在 [dfrobot 官方 wiki](https://wiki.dfrobot.com.cn/_SKU_DFR1075_FireBeetle_2_Board_ESP32_C6) 上找到。

# 更新 CircuitPython 固件
1. 下载 circuitpython 固件 [adafruit_feather_esp32c6_4mbflash_nopsram](https://circuitpython.org/board/adafruit_feather_esp32c6_4mbflash_nopsram) , 选择 adafruit_feather_esp32c6_4mbflash_nopsram 板卡的固件,因为和 FireBeetle 2 ESP32-C6 配置是一致的,除开引脚有一些区别,但是不影响
1. [点击下载 esptool Flash 烧录工具](https://www.espressif.com.cn/sites/default/files/tools/flash_download_tool_3.9.6_0.zip)
1. 运行 flash_download_tool_3.9.6.exe
1. 通过 USB 线连接电脑,选择 ESP32-C6 主控,然后按住 BOOT,点击 RST
1. 选择下载的固件,擦除flash后烧录固件
## 指令方式更新
# 搭建 circuitpython 环境
1. 烧录完成之后,复位芯片即可,和其他芯片不同的是,因为 ESP32 不支持 native USB,所以不会弹 CIRCUITPY 的驱动,只能借助其他工具用 REPL 去开发
1. 下载安装 [thonny](https://thonny.org/)
1. 运行 thonny.exe
1. 输入测试指令
# 编写 circuitpython 代码
1. circuitpython 启动时自动运行 code.py,我们在 code.py 编写自己的代码
> 注意事项
> 这边我没找到 adafruit_feather_esp32c6 的原理图,其实不知道引脚的定义情况,好在用 board.led 能点亮FireBeetle_2_Board_ESP32_C6 的灯。后续测试下其他外设引脚。
> 查看板卡支持引脚,可以使用 print(dir(board)) 输出
# 总结
esp32-c6 因为自身 USB 的问题,运行 circuitpython 固件没有 CIRCUITPY 磁盘,需要借助其他工具,这点比较麻烦,而且个人使用下来感觉 thonny 连接不是很稳定,尬住了
- 2024-04-18
-
回复了主题帖:
测评入围:FireBeetle 2 ESP32 C6开发板
个人信息无误,确认可以完成评测计划
- 2024-03-29
-
回复了主题帖:
【EEWorld发奖礼品--获奖名单】STM32 Summit全球在线大会
好久没中奖了,该轮到我了