Hi there,
I am trying to setup a task in Builder (using code snippets) to send event markers in a BIOPAC physiology recording. I am sending bytes via serial port from PsychoPy using pyserial and I’m not quite sure what I’m doing. I attached an image at the bottom that contains the digital acquisition channels that can be recorded in AcqKnowledge/BIOPAC. (here is a similar thread)
I have successfully opened the serial port, which sets one digital acquisition channel (upper pink, D9/D29) from 5 to 0 volts (and that channel remains at 0 until the port is closed)
import serial
ser = serial.Serial('COM4', baudrate = 115200, timeout=1)
Then the following code can set one or two different digital acquisition channels from 5 to 0 volts one time (green, D33/D13; lower pink, D34/D14). (I’m not entirely sure what this line directly below does - it seems to change based on what else is happening. I can provide more detail but I feel like I’m just missing something.)
ser.write("RR".encode())
Then, when the port is closed, the upper pink channel is set back to 5, as described in parentheses above. Also, if the ser.write(“RR”.encode()) was used, the blue channel (D32/D12) is sometimes set to 0 one time upon close.
ser.close()
So, I think I’m starting to understand some of what is happening above but if anyone could provide a better explanation I would be very appreciative. However, the biggest question that I’m having trouble with is how to trigger specific channels. It seems as if whenever I send a byte when the port is open, it only ever triggers the green channel (D33/D13). For example,
ser.write(b'36')
ser.flush()
seems to be the same channel and information as
ser.write(b'10')
ser.flush()
I know that one way to code events in AcqKnowledge would be to send triggers to specific BIOPAC channels, and then those channels could represent unique codes or they could be combined into a calculated channel. Would anyone be able to point me in the direction of how to accomplish that? Or, if there are any other ways that we could use to mark events in an AcqKnowledge recording via serial port, that would also be helpful. Thanks!