Hi There!
I’m afraid I wouldn’t consider myself an expert in biopac or the python serial library enough to answer this question thoroughly - and we might need some more info on the type of BIOPAC system you are using - but I will try to be as helpful as possible!
My first guidance would always be towards to serial documentation, which I think you have probably already explored. For the command ser.write("RR".encode)
which you ask about, the encode()
part of this is encoding a string to bytes. the write
part is to write those bytes to the serial port. I think without this some serial
users had issues writing a string to the port without it first being converted to a byte array.
In terms of guidance how to move forward, I notice that there are some related posts on the forum. I also wonder if this blog might be helpful - you could try adding the repository folder to your experiment .psyexp file location and importing it using a code component. The code used in the blog should in theory also work from PsychoPy I believe (though it might depend on what BIOPAC system you are using). You wouldn’t need to do any of this bits relating to creating a window though, as PsychoPy will do that for you. I would be interested to hear if this works so if you do give that approach a try, it would be great if you could report back!)
Sorry I can’t be of more specific help!
Becca