Sending triggers to Nexus Trigger Interface via serial port
Hi,
I'm Laura and I'm working on building an experiment that records heart rate variability and changes in skin conductance while certain sounds are presented. For that, I'm trying to use a Mind Media NeXus Trigger Interface. But it doesn't seem to work. I'm new to OpenSesame and uncertain about what I'm doing wrong and even what exactly the errors mean, that appear.
I used
and in the trial
My loop table looks like this
And I keep getting the error messages:
- TypeError
- exception message: an integer is required (got type Serial)
and:
TypeError: unicode strings are not supported, please encode to bytes: 'M'
Can somebody help me? Any help is appreciated!
Thank you in advance and best regards!
Comments
Hi @LauraHV ,
Python has two different kinds of objects for representing text-like data. The first is a
strobject, which is what you would normally use because it can deal with non-ASCII text. Thechr()function returns astrobject. The second is abytesobject, which is the old-fashioned kind of text representation, which nowadays you would only use in specific cases, such as when using the serial port.In your case, using
bytes()rather thanchr()should resolve the secondTypeError(I don't understand where the first comes from):As an aside, there is no need to attach variables as properties to the
expobjects. This is used to be necessary many versions of OpenSesame ago. If you feel like cleaning up your code a bit (which is not necessary, but might make life easier), take a look at:— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!