1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
:mod:`psychopy.serial` - functions for interacting with the serial port
=================================================================================
PsychoPy is compatible with Chris Liechti's `pyserial <http://pyserial.sourceforge.net>`_ package. You can use it like this::
import serial
ser = serial.Serial(0, 19200, timeout=1) # open first serial port
#ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)#or something like this for mac/linux machines
ser.write('someCommand')
line = ser.readline() # read a '\n' terminated line
ser.close()
Ports are fully configurable with all the options you would expect of RS232 communications. See http://pyserial.sourceforge.net for further details and documentation.
pyserial is packaged in the Standalone (win and mac distributions), for manual installations you should install this yourself.
|