Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RF24 USBDevice mbed
Diff: Thermistor.h
- Revision:
- 1:8766173d267f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Thermistor.h Mon Oct 19 22:03:12 2015 +0000
@@ -0,0 +1,88 @@
+#ifndef Thermistor_H
+#define Thermistor_H
+
+#include "mbed.h"
+#include <math.h>
+/**
+* Reads the resistance of thermistor and using Steinhart–Hart equation
+* converts it to Celsius
+*
+*/
+class Thermistor{
+public:
+ /**
+ * Constructor. In the calculations used a model of
+ * the resistance of a semiconductor at different temperatures -
+ * The Steinhart–Hart equation. Need to set the coefficients a, b, c.
+ *
+ * @param inputChanel The analog input is connected to the sensor
+ * @param a Steinhart–Hart coefficient
+ * @param b Steinhart–Hart coefficient
+ * @param c Steinhart–Hart coefficient
+ */
+ Thermistor(AnalogIn inputChanel, double a, double b, double c);
+
+ /**
+ * The temperature in degrees Celsius
+ * @returns Temperature
+ */
+ double getTemperature();
+
+ /**
+ * Set error value used in the calculation.
+ * The resulting resistance is computed as <real resistance> - error;
+ * @param error Error in Ohms
+ */
+ void setError(double error);
+
+ /**
+ * Error value used in the calculation
+ * The resulting resistance is computed as <real resistance> - error;
+ * @returns Error in Ohms
+ */
+ double getError();
+
+ /**
+ * Set a coefficient of Steinhart–Hart equation
+ * @param a a-coefficient
+ */
+ void setCoefficientA(double a);
+
+ /**
+ * Set b coefficient of Steinhart–Hart equation
+ * @param b b-coefficient
+ */
+ void setCoefficientB(double b);
+
+ /**
+ * Set c coefficient of Steinhart–Hart equation
+ * @param c c-coefficient
+ */
+ void setCoefficientC(double c);
+
+ /**
+ * a coefficient of Steinhart–Hart equation
+ * @returns a coefficient
+ */
+ double getCoefficientA();
+
+ /**
+ * b coefficient of Steinhart–Hart equation
+ * @returns b coefficient
+ */
+ double getCoefficientB();
+
+ /**
+ * c coefficient of Steinhart–Hart equation
+ * @returns c coefficient
+ */
+ double getCoefficientC();
+
+private:
+ AnalogIn input;
+ //Thermistor error in Ohms
+ double error;
+ double a, b, c;
+};
+
+#endif
\ No newline at end of file