I have this Python DLL from Mantracourt Engineering for reading from a loadcell via wireless telemetry. The hardware consists of a unit connected to PC by USB and similar unit attached to the loadcell. I have just about got it to work in Visual Studio and the output looks like that below. I want to access the item called Value from Labview and looking on labview forum it says I just need to add the following code in Python. I am very new to Python and coding proper but have done quite a lot of graphical coding. So my question is how to make that data item accessible?
I have looked at the code and identified two locations that refer to the output (bottom) presumably I could add the piece of code somewhere and make MyFunction = Value?
Any comments gratefully received.
Mantracourt driver location
def MyFunction_Add(num1, num2):
return num1+num2
**Visual Studio.
Pairing…
Successfuly paired with device ID: fd882e with Data Tag: 882e
Model: T24-SA
Press any key to command device to resume normal operation
Stay Awake Mode now on.
Registered callbacks
Data Provider Callback: Base Station: 1 Data Tag: 882e Value: -0.5397806167602539
Status: 16 Error: No Low Batt: No RSSI: -25 CV: 150
Registered callbacks
Data Provider Callback: Base Station: 1 Data Tag: 882e Value: -0.5413785576820374
Status: 16 Error: No Low Batt: No RSSI: -27 CV: 148**
import ctypes
def callbackdp( BaseStation, DataTag, Value, Status, Err, LowBatt, RSSI, CpV ):
print("Data Provider Callback: Base Station: {} Data Tag: {} Value: {} Status: {} Error: {} Low Batt: {} RSSI: {} CV: {}".format(BaseStation, hex(DataTag).lstrip("0x"), Value, Status, "Yes" if Err == 1 else "No" , "Yes" if LowBatt == 1 else "No", RSSI*-1, CV))
return
if iDATAPROVIDERINFO(DataTag, byref(BaseStation), byref(Value), byref(Status), byref(RSSI), byref(CV), byref(Err), byref(LowBatt), byref(msInterval), byref(msLastReceived)) == 1:
print("Data Provider Info for Data Tag: {} Base Station: {} Value: {} Status: {} RSSI: {} CV: {} Error: {} Low Batt: {} ".format(hex(DataTag).lstrip("0x"), BaseStation.value, Value.value, Status.value, RSSI.value*-1, CV.value, "Yes" if Err.value == 1 else "No" , "Yes" if LowBatt.value == 1 else "No"))
else:
print("No data received from Data Tag: {}n".format(userin))
else:
print("Invalid Data Tag entered!n")