生成并显示指定内容的二维码
以
ESP
系列芯片为例
-
在
MicroPython
项目同级目录克隆或粘贴本项目文件夹,并将文件夹重命名为qrcode
git clone https://gitee.com/walkline/micropython-qrcode-cmodule qrcode
-
根据
MicroPython
项目固件编译说明做好前期准备 -
使用如下命令编译固件:
cd micropython/ports/esp32 make USER_C_MODULES=../../../../qrcode/cmodules/micropython.cmake
控制台 | TFT | OLED |
---|---|---|
![]() |
![]() |
![]() |
参考项目目录下tests
文件中的代码。
查看 模块方法列表
生成二维码,并在控制台打印输出
>>> import qrcode
>>> _qrcode = qrcode.QRCODE()
>>> _qrcode.ecc_level(qrcode.ECC_HIGH)
>>> _qrcode.generate('https://gitee.com/walkline/micropython-qrcode-cmodule')
I (66945) QRCODE_MODULE: Encoding below text with ECC LVL 3 & QR Code Version 40
I (66945) QRCODE_MODULE: https://gitee.com/walkline/micropython-qrcode-cmodule
>>> print(_qrcode)
<QRCODE version=6, max_version=40 length=41, ecc_level=3, buffer_size=210>
>>> _qrcode.print()
>>>
# 使用 ab 工具烧录固件
$ ab --flash
# 使用 ab 工具上传相关文件
$ ab
# 使用 ab 工具打开串口
$ ab --repl
# 使用快捷键 ctrl+r,并选择以 _test 结尾的文件
- 联系邮箱:walkline@163.com
- QQ 交流群: