File: serial.rst

package info (click to toggle)
psychopy 1.73.06.dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,900 kB
  • sloc: python: 29,941; makefile: 153; sh: 20
file content (17 lines) | stat: -rw-r--r-- 887 bytes parent folder | download | duplicates (2)
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.