THUM DLL Price: $50

 

Sample Visual Basic.Net 2003 code to take readings from the THUM using DLL

 



 

Functions
Read - instructs the THUM device to take a reading.  It will read both temperature and humidity.
GetTempUnit
- returns the unit of temperature as 1 or 2 (1 means °C or 2 means °F)
SetTempUnit - sets the unit of temperature - valid values 1 or 2 (1 sets to °C and 2 sets to °F)
GetTemp - returns the temperature in the units set by SetTempUnit
GetRH - returns the relative humidity reading
GetDewPt - returns the dew point reading
Reset
- resets the THUM device - generally this function is not needed 

 

Possible Error Codes returned from functions
THUM_ERROR_SUCCESS             0   // no error
THUM_ERROR_BADTEMPUNIT      1   // bad temperature unit (not 1 or 2)
THUM_ERROR_THUMNOTFOUND  2   // THUM device not found
THUM_ERROR_READTIMEOUT     3   // Read operation timed out
THUM_ERROR_WRITEFAILED       4   // Write operation failed
THUM_ERROR_READFAILED         5   // Read operation failed
THUM_ERROR_RESULTOUTOFRANGE   6   // Temp or RH was out of range 

Note: Readings can not be taken from the THUM faster than one reading every 3 seconds. Taking readings faster than this could raise the internal temperature of the sensor. This could skew the temperature and RH readings returned from the THUM.

License:
We require that you purchase one copy of a control per developer on a project. If this is met, you may distribute the DLL with your application royalty free. You may never distribute the .h file.
 

 

Sample Visual Basic.Net 2003 code to read values from the THUM

 

'**************************Module**********************
Imports System.Runtime.InteropServices

Module Module1

<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function Read() As Integer
'Tell the THUM unit to take a temperature and RH reading.
End Function
<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function GetTemp() As Double
'get temperature reading
End Function
<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function SetTempUnit(ByVal cUnit As Double) As Integer
'Sets the temperature unit (to F or C).
End Function
<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function GetRH() As Double
'Gets the relative humidity from the THUM unit.
End Function
<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function GetTempUnit() As Integer
'Gets the temperatire unit (F or C).
End Function
<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function GetDewPt() As Double
'Gets the dew point from the unit.
End Function
<DllImport("C:\My Documents\Visual Studio Projects\THUMdllTest\thum.dll")> _
Public Function Reset() As Integer
'Reset THUM unit.
End Function
End Module


'********************Code in Button*******************
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim iRetVal As Integer 'Return Value.
Dim dblTempUnits As Double
dblTempUnits = 2
iRetVal = SetTempUnit(dblTempUnits)
MsgBox(iRetVal)
iRetVal = Read()
MsgBox(iRetVal)
Msgbox GetTemp()
End Sub
 

  

 

Start monitoring your environment with your own programs

THUM DLL Price: $50 per developer

Secure Server Purchase
  Pay me securely with any major credit card through PayPal!