psychopy.org | Reference | Downloads | Github

Labjack only sends trigger '1'

Hi there,

I am migrating my experiment code from MATLAB over to Python and from Psychtoolbox -> PsychoPy. I have run into an issue where the LabJack is only sending the trigger ‘1’ all the time.

This same issue was raised in a post I found back in 2016 by Thomas Bullock in this post:

He had this test code (that I’ve changed in very minor ways) and reported the same problem. A response to his post was to use address 6700. That didn’t work for him (it didn’t send any triggers) and the same thing happened to me. He then went on to say that using address 6701 did work for him. However, unfortunately when I tried that solution, it didn’t work for me. I still see only 1s for every value.

import psychopy, time
from psychopy.hardware.labjacks import U3
p_port = U3()

# initial set port to zero
byte=0
p_port.setData(byte, endian='big', address=6701) #6008

for loop_byte in range(1,50):
    time.sleep(.1) # wait between triggers
    p_port.setData(loop_byte)    # send trigger
    print loop_byte # print to output

#close labjack
p_port.close()

I am using Python 2.7 (for pylink reasons), psychopy version is 3.0.4. I’m on Windows 10 and using Coder interface (is that what you just call scripting / not using Builder? If so, that’s what I am doing).

The LabJackPython version I installed was the latest one from today, LabJackPython 2.0.0.

Is anyone able to give a hint on what might be going wrong here?

Many thanks in advance
Alex

Update:

I decided to just loop from address 6,000 to 7,000 in a try/except fashion and the addresses that were valid revealed which address allows the triggers to be sent that don’t default to just ‘1’.

In my case it was address 6751.

I’ll leave this up here in case anyone else still gets the same error.
For anyone else that wants to try, here is the code I used:

for address in range(6500,7000):
    try:
        byte=0
        p_port.setData(byte, endian='big', address=address) #6008
        print("Using address: {}".format(address))
        for loop_byte in range(1,6):
            time.sleep(.5) # wait between triggers
            p_port.setData(loop_byte, address=address)    # send trigger
            #print loop_byte # print to output
    except:
        #print("Skipping address: {}".format(address))
        continue

#close labjack
p_port.close()

It took a bit of whittling down and running from stimulus computer to the EEG screen in the next room but it allowed me to solve the problem!