Connecting Python and Cleware devices is very easy.
This is a sample to get the temperature value of a Cleware sensor (download)
from ctypes import *
mydll=windll.LoadLibrary("USBaccessX64.dll") # 32 bit w/o X64
cw=mydll.FCWInitObject()
devCnt=mydll.FCWOpenCleware(0)
print("found ", devCnt, " devices")
serNum=mydll.FCWGetSerialNumber(0,0)
devType=mydll.FCWGetUSBType(0,0)
print("first serNum = ", serNum, ", devType = ", devType) # just for info
Temperature = mydll.FCWIGetTemperature(0, 0)
print("Temperature = ", Temperature/1000.)
Controlling a kind of Cleware switch, multiplexer or traffic light:
deviceID=0 # when more than 1 device is connected, the serial number could be used
Schalter=16 # 16 is first switch, 17 the second etc.
State=1 # 0=off, 1=on
FCWSetSwitch(0, deviceID, Schalter, State)
A switching sample to control an USB-Multiplexer could be found here
The USBaccess.dll should be at least Version 5.2.6 | |