| Reference | Downloads | Github

Send event marker through Labjack U3-LV to Biopac

Dear all,

Greetings. We are trying to send event markers to Biopac through Labjack. And here is our main code component (the timer and labjack components has already been defined and imported before this). This code component was placed in the “Each Frame” section.

if timer.getTime > EventOnset:
if timer.getTime > EventOffset:

Here, “EventOnset”, “EventOffset” and “Channel” are variables read from excel files. What we are trying to do is when a given event occurs, we turn on channel number “Channel” after “EventOnset”, and turn it off after “EventOffset”.

We encounter two problems here:

  1. The labjack function setFIOState does not seem to take variable “Channel” here. Error message:

Got incorrect command bytes…Expected: [0xf8] Got: [0x0]

When we hard code the channel (we put “1” instead of “Channel” there), it worked. But we want to use a variable here.

  1. It does turn on the channel after “EventOnset”, but does not turn off the channel after “EventOffset”. There’s no error message. I could not tell from the code what’s wrong.

Thanks for your help!


As the function works when you hard code it with an integer 1, what is the chance that your variable is somehow made up of strings?

Your code is fighting against itself: if the time of EventOffset has passed, so has the time of EventOnset, so both signals will be sent on every screen refresh once the EventOffset time has elapsed.

You should probably maintain some flags like onset_signal_sent and offset_signal_sent that are initialised to False at the start of the trial, and then used to decide whether to send their respective signals (only i.e. send the signal if the time has elapsed and the value is False, and then set them to be True, so the sending happens only once).


Hi @Michael,

Thanks for your reply. It is very helpful - we’ve solved the event onset/offset problem according to your suggestions.

However, for the variable “Channel” issue, we used


to printout the variable type, it tells us it’s an integer. However, we still get the error message when trying to executing the code

Could you let us know what’s the potential issue with this?

Best Regards,