Hi,
I am using psychopy to run a fMRI experiment with a McBook pro.
In the scanner I am planning to use, there is a lsc-400b controller, which does not have any usb connection.
So, I got a usb-serial port, which has a male connector (I am not sure about the gender of the serial port of the lsc-400b controller at this moment, please let me know).
Regarding the software coding, to receive trigger pulse and subject’s button responses,
I guess that using pyxid library is the solution.
so at the top of my code,
import pyxid
devices = pyxid.get_xid_devices()
dev = devices[0]
if dev.is_response_device():
dev.reset_base_timer()
dev.reset_rt_timer()
Following the above,
dev.clear_response_queue()
noTrigger = True
while noTrigger:
dev.poll_for_response()
if dev.response_queue_size() > 0:
ttlpulse = dev.get_next_response()
if ttlpulse['key'] == 4:
noTrigger = False
I think this kind of coding might work.
It waits for the trigger pulse and when the pulse is received, the script escapes the while loop and proceeds further.
Am I correct?
any advice and info are grateful!!