python - 如何在“处理”python模式下写入串口
问题描述
我正在使用“处理”,在 java 模式下,我可以通过以下方式写入串行端口:
import processing.serial.*;
port = new Serial(this,Serial.list()[0] , 9600);
port.write('3')
在python处理中:
add_library('serial')
port = Serial(this,Serial.list()[0] , 9600)
port.write('3')
在 Java 中一切正常,但在 python 中,语句出现错误
'port.write('3'):
"processing.app.SketchException: TypeError: write(): expected 2 args; got 1"
解决方案
推荐阅读
- php - 表单数据不会进入我的数据库没有显示错误
- authentication - 如何为多个公司使用同一个帐户(就像同一个帐户可以用于 Slack 上的多个工作区)
- javascript - 如何在 VuePress 中编写带有预览的 Vue 代码演示?
- ios - 当使用 Parse 查询数据时,我的视图仅在重复后加载
- laravel - Laravel - 另一个模型中的查询范围不起作用
- javascript - 在 JSP 中的脚本中返回一个 JSON 数组对象
- laravel - 我的 Laravel 站点的视图文件出现了奇怪的问题,这怎么可能?
- wordpress - 错误:找不到内容区域,
- powershell - 运行表单时的Powershell输出问题
- node.js - 在 MongoDB 和 Node.js 中使用聚合方法获取多个数组