如何在“处理” python模式下写入串行端口

时间:2018-07-14 08:12:52

标签: python processing

我正在使用“处理”,并且在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"

0 个答案:

没有答案