Because otherwise the first code I wrote above did not work either…) But then, I receive this error:įile “C:\Program Files\PsychoPy\lib\site-packages\serial\serialutil.py”, line 68, in to_bytes return bytes(bytearray(seq)) I have also tried to change the settings in the properties of the excel coloums (I defined the values as “Text”, rather than “Standard”. “C:\Users\kppadmin\Desktop\Metin_Paradigm_2\Paradigm_2_ThirdTry_lastrun.py”, line 1451, in win.flip()įile “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\window.py”, line 1219, in flip callEntry(*callEntry, **callEntry) I want to use the win.callOnFlip function as described in the link above and as can be seen below: win.callOnFlip(port.write()) However I have some issues and any help would be appreciated:ġ. Port.write() # trigger_values_hab is the header of an excel coloumn where I define the triggers ![]() If face_hab.status = STARTED and not pulse_started: I have recently managed to send triggers via serial port, with a code similar to yours Begin Experiment: to check the frame timing is write here we also highly recommend checking with a photodiode for visual stimuli if you can. I think that should do the trick - but please do let me know if not!! So instead of port.write() it would be port.write() - please let me know if that works! If you have a column with the header “trigger_value” and write what you want the trigger value to be on each trial, you should in theory be able to use this in the port.write() command. Oh and in terms of setting the trigger value through a conditions file. If globalClock.getTime() - pulse_start_time >= 0.005: Win.callOnFlip(port.write()) # send the trigger but only when the window flips to ensure syncronisation In the Each frame tab use: if mything.status = STARTED and not pulse_started:# where "mything" refers to a visual thing you are trying to sync the trigger to (so you could have one of these for different component's in the same routine In your Begin Routine tab use: pulse_started = False ![]() Add a code component and in the “Begin Experiment” tab use: import serial Thanks for your question - we’re working on making some materials to help people with this - so your questions are really helpful thankyou! In answer to your third question, yes I do think a component for serial port communication would be helpful.
0 Comments
Leave a Reply. |