problem with sending different trigger to BrainVision Recorder with V-Amp, serial port
Dear community
Hi, I'm Lee, and it's my first time asking a question. Please understand If I'm not good at English.
I'm making simple oddball task for my ERP Experiment.
So I want to send different trigger at different stimuli.
but, BrainVision Recorder was received same trigger. just "S11".
at first, before start the experiment, I wrote the code like below at inline script(run).
import serial import time try: exp.port= serial.Serial('COM3') print 'serial port read', exp.port.name, exp.port.baudrate, exp.port.bytesize, exp.port.parity except: print 'serial port not read'
and the printed result of first inline script is here.
serial port read COM3 9600 8 N
and after each stimuli, I wrote the code like below.
value = var.triggervalue t = time.time() count = 0 try: while (time.time()-t) < 0.005 : #500Hz: >4ms / 250Hz: >8ms exp.port.write(str(value)) # or whatever is appropriate count += 1 print('trigger has been sent') print('value:',value,' time:',time.time()-t,' count:',count) except: print 'trigger not sent' self.sleep(200)
and the printed result is here. (value 1: prominent / value 2: odd)
trigger has been sent ('value:', 1, ' time:', 0.005000114440917969, ' count:', 58) trigger has been sent ('value:', 1, ' time:', 0.00599980354309082, ' count:', 32) trigger has been sent ('value:', 2, ' time:', 0.006000041961669922, ' count:', 36) trigger has been sent ('value:', 1, ' time:', 0.006000041961669922, ' count:', 34) trigger has been sent ('value:', 1, ' time:', 0.006000041961669922, ' count:', 67)
last, I end the experiment with this code
exp.port.close()
I expected this inline scripts would sent right trigger, but BrainVision Recorder received only "S11".
Why Recorder read the trigger only "S11", not "S1" nor "S2"? Where is "S11" from?
I read other forums(https://forumcogsci.nl/index.php?p=/discussion/491/solved-sending-different-triggers-via-serial-port etc), but I can't understand why and how I make mistake.
Could you explain what is wrong?
and I have one more question.
I send the trigger with "for" phrase, so I send lots of trigger at one time.
hhowcan I send the trig only one and long
If you could correct my mistake, I would be much appreciated.
Comments
Hi Lee,
I don't know how it works with serial ports, but when sending triggers through parallel ports, you have to unset after you changed a value. So every time you sent a value (say a 1), a little while later (for parallel ports ~10 ms) you send a zero. Like that you make sure that the triggers won't overlap or add up. Whether this is the reason why you only see S11, I don't know. Maybe you can experiment a little with the triggers (e.g. sending only number repeatedly, or sending different numbers than 1 and 2).
I send the trigger with "for" phrase, so I send lots of trigger at one time. how can I send the trig only one and long
I don't see where you used a for loop, but one straightforward way to adapt your code would be:
Eduard