Serial library with Processing.py

edited March 2016 in Python Mode

Generally, is there library documentation for the libraries with Processing.py?

Specifically, I'm trying to use the Serial library. Guessing the syntax from the Java documentation, I have:

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)   # this seems to need a first argument referring to the sketch object (analagous to "this" argument in Java)
    myPort.bufferUntil(LF)
    
def draw():
    pass
    
def serialEvent(evt):
    inString = evt.readString()
    print inString

Anyone have any advice on making this work?

As a side note, it would be nice to add a processing.py as a subcategory in the forums under "Questions and Modes".

Answers

Sign In or Register to comment.