Hello,
I try to send my trigger codes via a parallel port to our recording system. Unfortunately, PsychoPy is not satisfied with the installed drivers. To test the the signal transfer I started the “Parallel Ports Demo” provided by Psychopy. Here is the code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
parallel ports demo
This is for win32 only.
"""
from __future__ import division
from psychopy import visual, core
from psychopy import parallel
nFramesOn = 5
nFramesOff = 30
nCycles = 2
parallel.setPortAddress(0x378) # address for parallel port on many machines
pinNumber = 2 # choose a pin to write to (2-9).
# setup the stimuli and other objects we need
win = visual.Window([1280, 1024], allowGUI=False) # make a window
win.flip() # present it
myStim = visual.GratingStim(win, tex=None, mask=None, color='white', size=2)
myClock = core.Clock() # just to keep track of time
# present a stimulus for EXACTLY 20 frames and exactly 5 cycles
for cycleN in range(nCycles):
for frameN in range(nFramesOff):
# don't draw, just refresh the window
win.flip()
parallel.setData(0) # sets all pins low
for frameN in range(nFramesOn):
myStim.draw()
win.flip()
# immediately *after* screen refresh set pins as desired
parallel.setPin(2, 1) # sets just this pin to be high
# report the mean time afterwards
print('total time=%0.6f' % myClock.getTime())
print('avg frame rate=%0.3f' % win.fps())
# set pins back to low
win.flip()
parallel.setData(0) # sets all pins low again
win.close()
core.quit()
# The contents of this file are in the public domain.
Starting the script produc`es the following errors:
Willkommen auf PsychoPy2!
v1.84.0
()
##### Running: C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\demos\coder\hardware\parallelPortOutput.py #####
1.7963 WARNING psychopy.parallel has been imported but no parallel port driver found. Install either inpout32 or dlportio
1.7964 WARNING Could not initiate port: global name 'ParallelPort' is not defined
Traceback (most recent call last):
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\demos\coder\hardware\parallelPortOutput.py", line 32, in <module>
parallel.setData(0) # sets all pins low
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.0-py2.7.egg\psychopy\parallel\__init__.py", line 165, in setData
raise RuntimeError('Port address must be set using setPortAddress')
RuntimeError: Port address must be set using setPortAddress
Following the instructions, I installed the Inpout drivers from this website:
http://www.highrez.co.uk/Downloads/InpOut32/default.htm
As written in the documentation, I used the following file:
D:\InpOutBinaries_1501\Win32\InstallDriver.exe
Then, I got this message:
Successfully installed and opened 64bit InpOut driver InpOutx64.sys.
But, there is no change. I cannot send any signal via the parallel port, thus being not able to log trigger codes in the EEG recordings.
Do you have any idea?
PS: It works with Presentation…