Why my script couldn't trigger the TMS?

OS (e.g. Win10): Win 7
PsychoPy version (e.g. 1.84.x): 1.84.2
Standard Standalone? (y/n) yes
What are you trying to achieve?:
I want to trigger the TMS.
What did you try to make it work?:
Hi guys,
I built a program to achieve my experiment through Builder, then I transferred it to coder, the program can work, but it couldn’t trigger the TMS.
You can see the full script through attachment. The specific script is in line 475-483 and 783-791.

I hope to hear from you.tms_OBPnew.py (40.7 KB)

Did you get any error messages or warnings?

Hi Lukas,
Thank you for your attention.
There are no any messages and warnings. the program can run normally. However, the TMS can’t be activated

Is the port address (0x378) correct? You can check in the Device Manager in Windows what the address should be. Otherwise, double-check that you are getting a voltage-change on the pins using a multimeter (which might suggest you don’t have the drivers correctly installed). Failing that, what type of TMS machine are you using? If it’s a Magstim, do you have they safety interlock pressed down on the coil?

Hi Nicolas,
Thanks for your reply. The port address is right, and other people use the coder can send the trigger to TMS. how to check it through the second way? Could you see my script about the part of TMS? it is in line 475-483 and 783-791. I am not sure that is a right way.
the machine is PowerMAG 30/100Hz research stimulator.

Best wishes,
Chenglin

Hi Lukas,
I found some warnings,I am not sure it will affect to send the trigger.
Please see it through the picture.

No, dropped frames should not be related to your problem.

Yes, I think so.
The program can run normally. However, the TMS can’t be activated.
Could you see my script about the part of TMS? it is in line 475-483 and 783-791. I am not sure that is a right way.

Hi Lukas,
Do you have any relevant TMS program by using Builder?
If you have, could you share it with me? I just want to know how to activate the TMS?

Hi Nicolas,
Thanks for your reply. The port address is right, and other people use the coder can send the trigger to TMS. how to check it through the second way? Could you see my script about the part of TMS? it is in line 475-483 and 783-791. I am not sure that is a right way.
the machine is PowerMAG 30/100Hz research stimulator.

Best wishes,
Chenglin

If other people can send triggers just fine, that suggests either a code problem or a cable being unplugged. I don’t actually use the builder or builder-generated code, so it might be a bit hard for me to judge any problems in your script. The conditional statement leading to your code requires
fx1.status to be FINISHED (which seems like a constant that’s part of the builder?) and Pra_p_port.status to be NOT_STARTED. So I would start my debugging there. If you use an IDE like Spyder or VSCode, you can place some breakpoints around there and check what the status of those two objects is. Otherwise, use some print() statements to see whether the code inside that conditional is ever being reached in the first place.

Hi Nicolas,

Thank you for your suggestion. I will check them again.

Best wishes,

Chenglin

Nicolas McNair via PsychoPy Discourse psychopy@discoursemail.com 于2019年3月21日周四 上午2:33写道: