如何在电路python中进行非阻塞USB串行输入? [英] How to do non blocking usb serial input in circuit python?

查看:35
本文介绍了如何在电路python中进行非阻塞USB串行输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用串行读写在我的计算机上将 micropython 板与 python 接口,但是我找不到在 micropython 中读取非阻塞 USB 串行数据的方法.

I am trying to interface a micropython board with python on my computer using serial read and write, however I can't find a way to read usb serial data in micropython that is non-blocking.

基本上我想调用输入函数而不需要输入继续.(类似于 https://github.com/adafruit/circuitpython/pull/1186但对于USB)

Basicly I want to call the input function without requiring an input to move on. (something like https://github.com/adafruit/circuitpython/pull/1186 but for usb)

我尝试过使用 tasko,uselect(它无法导入库,我不能找到下载),并等待功能.我不确定是否有办法做到这一点,但任何帮助将不胜感激.

I have tried using tasko, uselect (it failed to import the library and I can't find a download), and await functions. I'm not sure it there is a way to do this, but any help would be appreciated.

推荐答案

对于 CircuitPython,有 supervisor.runtime.serial_bytes_available 它可以为您想要做的事情提供构建块.

For CircuitPython there's supervisor.runtime.serial_bytes_available which may provide the building block for what you want to do.

这在 Adafruit 上进行了讨论论坛:通过USB接收来自计算机的命令.

这篇关于如何在电路python中进行非阻塞USB串行输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆