Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Digital Out whilst Input Streaming?


  • Please log in to reply
1 reply to this topic

#1 mikelwrnc

mikelwrnc
  • Members
  • 17 posts

Posted 10 October 2014 - 07:09 AM

I'm using the python interface, trying to read data from a photocell in streaming mode, check if the resulting data exceed some criterion, and if so, change the value on a digital output pin. My code is:

import numpy as np
import u3
import time
d = u3.U3()
d.configU3()
d.getCalibrationData()
d.configAnalog(u3.FIO0)
d.streamConfig(NumChannels=1,PChannels=[0],NChannels=[31],Resolution=0,ScanFrequency=2500)
d.streamStart()
checkForZeroTime = False
for content in d.streamData():
	if checkForZeroTime:
		if time.time()>=nextZeroTime:
			d.getFeedback(u3.BitStateWrite(IONumber=11,State=0))
			checkForZeroTime = False
	if content is not None:
		data = content['AIN0']
		if np.any(np.array(data)>1):
			d.getFeedback(u3.BitStateWrite(IONumber=11,State=1))
			nextZeroTime = time.time()+1
			checkForZeroTime = True

However, the device to which the output is attached isn't picking up any of the output events. When I just do:

import u3
d = u3.U3()
d.configU3()
d.getFeedback(u3.BitStateWrite(IONumber=11,State=1))

The device does indeed receive an output event, so this doesn't seem to be a wiring issue. 

 

Is it possible that when the u3 is in streaming input mode it can't do any digital outputs?



#2 mikelwrnc

mikelwrnc
  • Members
  • 17 posts

Posted 10 October 2014 - 08:37 AM

Nevermind! It was a problem with the device connected to the ouput.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users