import sys sys.path.append("/ner/lib/python/nerhw") import ljm import time resolution = 8 vrange = 10.0 dio_direction = 0x3f nanalog = 14 rate = 10.0 # connect to and start streaming from first labjack lj1 = ljm.openS("T7", "Ethernet", "192.168.0.30") keys, values = ["AIN_ALL_NEGATIVE_CH", "AIN_ALL_RANGE", "STREAM_SETTLING_US", "STREAM_RESOLUTION_INDEX"], \ [ljm.constants.GND, vrange, 0, resolution] ljm.eWriteNames(lj1, len(keys), keys, values) ljm.eWriteName(lj1, "DIO_DIRECTION", dio_direction) chs = ["CORE_TIMER", "STREAM_DATA_CAPTURE_16"] + ["AIN" + str(i) for i in range(nanalog)] scanlist = ljm.namesToAddresses(len(chs), chs)[0] ljm.eStreamStart(lj1, 1, len(scanlist), scanlist, rate) # connect to and start streaming from second labjack lj2 = ljm.openS("T7", "Ethernet", "192.168.0.33") keys, values = ["AIN_ALL_NEGATIVE_CH", "AIN_ALL_RANGE", "STREAM_SETTLING_US", "STREAM_RESOLUTION_INDEX"], \ [ljm.constants.GND, vrange, 0, resolution] ljm.eWriteNames(lj2, len(keys), keys, values) ljm.eWriteName(lj2, "DIO_DIRECTION", dio_direction) chs = ["CORE_TIMER", "STREAM_DATA_CAPTURE_16"] + ["AIN" + str(i) for i in range(nanalog)] scanlist = ljm.namesToAddresses(len(chs), chs)[0] ljm.eStreamStart(lj2, 1, len(scanlist), scanlist, rate) for i in range(5): # print("lj1", ljm.eStreamRead(lj1)) print("lj2", ljm.eStreamRead(lj2)) time.sleep(1) #ljm.eStreamStop(lj1) ljm.close(lj1) ljm.eStreamStop(lj2) ljm.close(lj2)