powershell - 为什么我从 Powershell 脚本写入串口后无法读取串口上的内容?
问题描述
这是我的代码简化:
> [System.IO.Ports.SerialPort]::getportnames() #to get all the port names
COM1
COM2
COM3
$port = new-Object System.IO.Ports.SerialPort "COM1",9600,None,8,one
$port.Open()
$port.Write("Hey")
Start-Sleep -Milliseconds 3000 #I wait to make sure it gets written
$port.ReadExisting()
什么都没有返回。
当它应该返回“嘿”时,为什么它什么也不返回?我怎样才能正确地在端口上写入并读取它?
解决方案
推荐阅读
- flutter - 在 Flutter 中处理用户会话是否有比使用“flutter_session”或“local_storage”更好的方法,或者无法在移动设备上处理?
- asp.net-core - 通过 web.config 切换到新的应用程序版本
- python - Python 读取 JSON 文件中的多个值作为字典
- php - 每次我重新加载我的网站时,它都会在我的 JSON 文件中添加一个新用户?我怎样才能防止这种情况?
- python - 我找不到正确循环这个刽子手代码的方法
- c# - 获取经过身份验证的用户的全名
- php - while 循环从数字 934 中减去 6.3,直到数字 * 介于(不等于)47 和 57 之间
- ruby-on-rails - 如何在邮件程序中使用模板变量
- bash - 如何将多行查询结果存储在bash变量中
- javascript - “错误:节点不可见或不是 HTMLElement”。傀儡师