I modified the ktypeExample.py code to work with the U3 as the following:
import u6
#...
d=u6.U6()
#...
TCmVolts = d.getAIN(0, resolutionIndex = 8,gainIndex = 3) * 1000
and replaced that with:
import u3
#...
d = u3.U3()
d.getCalibrationData()
#...
TCmVolts = ((d.getAIN(0) - 0.4) / 51) * 1000
When I run the code I get the following error as seen in the uploaded picture. I am just trying to get a temp reading from the ktype thermocouple I have. Any ideas for fixes?
It looks like you are trying to read FIO0 as an analog input, but it is configured for a digital line. I didn't account for this in my post of that code. Either use LJControlPanel panel and set the power up defaults for your FIO/EIO lines so they are configured by default to be the appropriate analog or digital line, or in your code after opening your U3 and before getAIN perform a call like:
d.configIO(FIOAnalog=1) # This sets FIO0 to an analog input and the rest to digital I/O (1 = b00000001)
Note that when setting FIOAnalog, each bit of the value represents a lines setting, where bit 0 - FIO0, bit 1 = FIO1, etc., and a setting of 1 = analog input and 0 = digital line. For example if you wanted only FIO0 and FIO2 to be analog inputs and the rest digital, set FIOAnalog to 5 (b00000101).