【雕爷学编程】MicroPython动手做(02)——尝试搭建K210开发板的IDE环境4

7、使用串口工具

(1)连接硬件

连接 Type C 线, 一端电脑一端开发板

查看设备是否已经正确识别:

在 Windows 下可以打开设备管理器来查看

如果没有发现设备, 需要确认有没有装驱动以及接触是否良好

(2)下载串口工具

(a) putty

https://www.chiark.greenend.org.uk/\~sgtatham/putty/latest.html

(b)xshell

https://xshell.en.softonic.com/download

(3)然后选择串口模式, 然后设置串口和波特率,打开串口。

(4)检查固件版本

使用串口终端PuTTY打开串口,然后复位(或按ctrl+D),看输出的版本信息,与github 或者 master 分支 的固件版本对比,根据当前版本情况考虑升级到最新版本。这里烧录的固件版本是" v0.5.0-31-gd3e71c0" 。

(5)串口终端PuTTY的控制命令:

CTRL-A-在空白行上,进入原始REPL模式

CTRL-B-在空白行上,进入常规REPL模式

CTRL-C-中断正在运行的程序

CTRL-D-在空白行上,对电路板进行软复位

CTRL-E-在空白行上进入粘贴模式

(6)有关可用模块的列表,请键入help('modules')

KPU gc random uio

Maix hashlib re ujson
main heapq sensor ulab

_boot image socket uos

_thread json struct urandom

_webrepl lcd sys ure

array machine time usocket

audio math touchscreen ustruct

binascii math ubinascii utime

board micropython ucollections utimeq

builtins modules ucryptolib uzlib

cmath nes uctypes video

collections network uerrno zlib

errno os uhashlib

fpioa_manager pye_mp uheapq

Plus any modules on the filesystem

8、Hello world!

#尝试搭建K210的Micropython开发环境(Win10)

#实验程序之一:串口打印'hello maixpy',固件版本号

python 复制代码
#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之一:串口打印'hello maixpy',固件版本号

import sys

for i in range(0, 2):
    print("hello maixpy")
    print("hello ", end="maixpy\n")

print("implementation:", sys.implementation)
print("platform:", sys.platform)
print("path:", sys.path)
print("Python version:", sys.version)

print("please input string, end with Enter")
r = sys.stdin.readline()
w_len = sys.stdout.write(r)

#尝试搭建K210的Micropython开发环境(Win10)

#实验程序之二:IDE中断

python 复制代码
#尝试搭建K210的Micropython开发环境(Win10)
#实验程序之二:IDE中断

import _thread
import time

def func(name):
    while 1:
        print("hello {}".format(name))
        time.sleep(1)

_thread.start_new_thread(func,("1",))
_thread.start_new_thread(func,("2",))

while 1:
    pass
相关推荐
云山工作室1 小时前
基于单片机的牧场奶牛养殖系统设计(论文+源码)
stm32·单片机·嵌入式硬件·毕业设计·毕设
三佛科技-134163842122 小时前
制冰机方案,家用制冰机MCU控制方案开发设计
单片机·嵌入式硬件·智能家居·pcb工艺
sali-tec2 小时前
C# 基于halcon的视觉工作流-章56-彩图转云图
人工智能·算法·计算机视觉·c#
梦想画家3 小时前
基于PyTorch的时间序列异常检测管道构建指南
人工智能·pytorch·python
Elastic 中国社区官方博客3 小时前
在 Elasticsearch 中使用 Mistral Chat completions 进行上下文工程
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
一碗绿豆汤3 小时前
机器学习第二阶段
人工智能·机器学习
PythonFun4 小时前
OCR图片识别翻译工具功能及源码
python·ocr·机器翻译
用什么都重名4 小时前
DeepSeek-OCR 深度解析
人工智能·ocr·deepseek-ocr
河南骏4 小时前
RAG_检索进阶
人工智能·深度学习
虫师c4 小时前
Python浪漫弹窗程序:Tkinter实现动态祝福窗口教程
python·tkinter·动画效果·gui编程·弹窗效果