Micropython学习笔记--Python语言实现串口读写
前文提到,HaaS Python轻应用是对Micropython的深度定制和扩展,本节开始,将详细介绍基于HaaS Python轻应用如何完成串口数据读写
运行的硬件环境: HaaS100开发板,HaaS EDK K1等
# Coding=utf-8# This is a sample Python script.import utimefrom driver import UARTprint("-------------------uart test--------------------")print("-----How to test: connect PIN10 and PIN12-------")uart = UART();uart.open("serial2")utime.sleep_ms(1000)writeBuf = bytearray([0x41, 0x42, 0x43, 0x44]);for i in range(10): uart.write(writeBuf) utime.sleep_ms(1000) readBuf = bytearray(4) recvSize = uart.read(readBuf) utime.sleep_ms(100) print(recvSize) print(readBuf)uart.close()
钉钉扫码入群,获取更多python轻应用相关的知识,有软件专家事实解答您的问题。
总结
以上是内存溢出为你收集整理的Micropython学习笔记--Python语言实现串口读写全部内容,希望文章能够帮你解决Micropython学习笔记--Python语言实现串口读写所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)