This C# application contains the PapouchSensorTM class, which may be used in your applications to read data from the "TM" digital thermometer.
Microsoft .NET Framework 2.0 is required for running this application. Microsoft Visual Studio 2005 or Microsoft Visual C# Express is required to open the sample project and to compile the application.
Constructor of this class takes single argument, which is name of serial port to which is the TM sensor connected, ie. COM1. Then call the ReadSample method to get current temperature in degrees of Celsius. The following code demonstrates the usage:
PapouchSensorTM sensor = new PapouchSensorTM("COM1");
try {
float t = sensor.ReadSample();
MessageBox.Show(string.Format("Temperature is {0:N1} °C", t), "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex) {
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
Manufacturer of the TM sensor is Papouch, s. r. o.
Author of this sample is Michal Altair Valasek from Altairis, s. r. o.
Copyright © Michal Altair Valasek - Altairis, 2006
This program is free software licensed under terms of the BSD license.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.