Exemplo n.º 1
0
" WindowsDriverSample.py
" Author: LabJack Corporation
"
"
" This driver shows some of the basic functions 
" of the LabJackPython driver.
"""

#The LabJackPython.pyc file should be in the Python\Lib directory
from LabJackPython import LabJackPython

try:
    if __name__ == "__main__":

        #Open a UE9 over usb with the first found flag.
        ue9Handle = LabJackPython.OpenLabJack(LabJackPython.LJ_dtUE9,
                                              LabJackPython.LJ_ctUSB, "0", 1)

        #Get Channel 0
        ain0 = LabJackPython.eGet(ue9Handle, LabJackPython.LJ_ioGET_AIN, 0, 0,
                                  0)
        print "eGet AIN0:" + str(ain0)

        #Add request to get channel 0
        LabJackPython.AddRequest(ue9Handle, LabJackPython.LJ_ioGET_AIN, 0, 0.0,
                                 0, 0.0)
        LabJackPython.Go()
        ain0 = LabJackPython.GetResult(ue9Handle, LabJackPython.LJ_ioGET_AIN,
                                       0)
        print "addRequest AIN0:" + str(ain0)

except Exception, e:
Exemplo n.º 2
0
#The LabJackPython.pyc file should be in the Python\Lib directory
from LabJackPython import LabJackPython
from LabJackPython import LabJackException
import msvcrt

try:
    if __name__ == "__main__":

        scanrate = 100
        done = False
        numReads = 0

        #Open a UE9 over usb with the first found flag.
        #Comment out if using a U3
        deviceHandle = LabJackPython.OpenLabJack(LabJackPython.LJ_dtUE9,
                                                 LabJackPython.LJ_ctUSB, "1",
                                                 1)

        #FOR U3 ONLY Uncomment if using a U3
        #Open the U3 Device
        #deviceHandle = LabJackPython.OpenLabJack(LabJackPython.LJ_dtU3, LabJackPython.LJ_ctUSB, "1", 1)
        #Set FIO 2 and 3 as Analog Inputs
        #LabJackPython.ePut(deviceHandle, LabJackPython.LJ_ioPUT_ANALOG_ENABLE_BIT, 3, 1, 0)
        #LabJackPython.ePut(deviceHandle, LabJackPython.LJ_ioPUT_ANALOG_ENABLE_BIT, 2, 1, 0)

        #Configure the Stream Mode:
        #Configure all analog inputs for 12-bit resolution
        LabJackPython.AddRequest(deviceHandle, LabJackPython.LJ_ioPUT_CONFIG,
                                 LabJackPython.LJ_chAIN_RESOLUTION, 12, 0, 0)

        #Configure the analog input range on channel 0 for bipolar +-5 volts.