Python processing.py中的串行库文档

Python processing.py中的串行库文档,python,arduino,processing,jssc,Python,Arduino,Processing,Jssc,是否有用于处理.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(Seria

是否有用于处理.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
用于创建串行实例的Java语法将“this”作为第一个参数,我假设它引用了Sketch(PApplet)对象。如何在processing.py中引用它?

Re:您最初的问题-这里没有特定于Python模式的库文档。我们希望提到香草和/或

Re:由您的代码导致的错误-正如您在注释中指出的,将
this
作为
Serial()
实例化的第一个参数应该可以做到这一点。以下内容在我的机器上运行良好:

add_library('serial')

def setup():
    #setup the serial port
    print Serial.list()
    portIndex = 0
    LF = 10
    print " Connecting to ", Serial.list()[portIndex]
    myPort = Serial(this, Serial.list()[portIndex], 9600)
    myPort.bufferUntil(LF)

基于,Python似乎仍然接受
这个
作为函数参数。如果我将
this
作为串行连接行的第一个参数,我会得到一个新的错误:
processing.app.SketchException:java.lang.unsatifiedLinkError:jssc.SerialNativeInterface.openPort(Ljava/lang/String;Z)J
如果在Python模式下提供this关键字以与处理java库兼容,几乎每个库都使用它:)