Processing.py 的串行库有一些文档吗?
我已经能够从 Java 串行库文档中猜出一些语法。这是我到目前为止所拥有的:
add_library('serial')
def setup():
#setup the serial port
print Serial.list()
portIndex = 4
LF = 10
print " Connecting to ", Serial.list()[portIndex]
myPort = Serial(Serial.list()[portIndex], 9600)
myPort.bufferUntil(LF)
def draw():
pass
def serialEvent(evt):
inString = evt.readString()
print inString
我收到以下错误:
processing.app.SketchException: TypeError: processing.serial.Serial(): 1st arg can't be coerced to processing.core.PApplet
创建 Serial 实例的 Java 语法将“this”作为第一个参数,我假设它指的是 Sketch (PApplet) 对象。我如何在 processing.py 中引用它?