7、使用串口工具
(1)連接硬件
連接 Type C 線, 一端電腦一端開(kāi)發(fā)板
查看設(shè)備是否已經(jīng)正確識(shí)別:
在 Windows 下可以打開(kāi)設(shè)備管理器來(lái)查看
如果沒(méi)有發(fā)現(xiàn)設(shè)備, 需要確認(rèn)有沒(méi)有裝驅(qū)動(dòng)以及接觸是否良好
(2)下載串口工具
(a) putty
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
(b)xshell
https://xshell.en.softonic.com/download
(3)然后選擇串口模式, 然后設(shè)置串口和波特率,打開(kāi)串口。
(4)檢查固件版本
使用串口終端PuTTY打開(kāi)串口,然后復(fù)位(或按ctrl+D),看輸出的版本信息,與github 或者 master 分支 的固件版本對(duì)比,根據(jù)當(dāng)前版本情況考慮升級(jí)到最新版本。這里燒錄的固件版本是“ v0.5.0-31-gd3e71c0” 。
(5)串口終端PuTTY的控制命令:
CTRL-A-在空白行上,進(jìn)入原始REPL模式
CTRL-B-在空白行上,進(jìn)入常規(guī)REPL模式
CTRL-C-中斷正在運(yùn)行的程序
CTRL-D-在空白行上,對(duì)電路板進(jìn)行軟復(fù)位
CTRL-E-在空白行上進(jìn)入粘貼模式
(6)有關(guān)可用模塊的列表,請(qǐng)鍵入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開(kāi)發(fā)環(huán)境(Win10)
#實(shí)驗(yàn)程序之一:串口打印‘hello maixpy’,固件版本號(hào)
#嘗試搭建K210的Micropython開(kāi)發(fā)環(huán)境(Win10)
#實(shí)驗(yàn)程序之一:串口打印‘hello maixpy’,固件版本號(hào)
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開(kāi)發(fā)環(huán)境(Win10)
#實(shí)驗(yàn)程序之二:IDE中斷文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-615294.html
#嘗試搭建K210的Micropython開(kāi)發(fā)環(huán)境(Win10)
#實(shí)驗(yàn)程序之二: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
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-615294.html
到了這里,關(guān)于【雕爺學(xué)編程】MicroPython動(dòng)手做(02)——嘗試搭建K210開(kāi)發(fā)板的IDE環(huán)境4的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!