simple temperature sensor
Dependents: HARP2 HARP3 Thermostat_NucleoF401 4180Lab4_p1 ... more
Diff: TMP36GZ.h
- Revision:
- 3:84ed914fb203
- Parent:
- 2:c368493b71a9
- Child:
- 5:dd80dac0124c
--- a/TMP36GZ.h Thu Sep 20 23:18:22 2012 +0000 +++ b/TMP36GZ.h Thu Sep 20 23:22:22 2012 +0000 @@ -1,4 +1,4 @@ -/** +/* * @author Tyler Weaver * * @section LICENSE @@ -27,7 +27,7 @@ * * /----\ * |1 2 3 | -* +* * 1 - Vs, connect 3.3V (Vout) * 2 - Vout - connect to input pin * 3 - GND - connect to ground @@ -41,50 +41,49 @@ */ #include "mbed.h" -/** TMP36GZ temperature sensor +/** TMP36GZ temperature sensor class * * Example: * @code -#include "mbed.h" -#include "TMP36GZ.h" - -TMP36GZ temp_sensor(p20); -Serial pc(USBTX, USBRX); // tx, rx - -int main() { - pc.baud(9600); - while(1) { - pc.printf("Temp: %6.3f deg/C - %6.3f deg/F\n", temp_sensor.sample(), temp_sensor.sample_f()); - wait(1.0); // wait 1 second - } -} +* #include "mbed.h" +* #include "TMP36GZ.h" +* +* TMP36GZ temp_sensor(p20); +* Serial pc(USBTX, USBRX); // tx, rx +* +* int main() { +* pc.baud(9600); +* while(1) { +* pc.printf("Temp: %6.3f deg/C - %6.3f deg/F\n", temp_sensor.sample(), temp_sensor.sample_f()); +* wait(1.0); // wait 1 second +* } +* } * @endcode */ class TMP36GZ { -private: - AnalogIn *input_pin_; - public: - - /* Constructor for TMP36GZ sensor + /** Constructor for TMP36GZ sensor * * Analog input pin from p15-p20 * * @param pin the analog input pin (connect to pin 2 on sensor) */ TMP36GZ(PinName pin); - - /* Sample the sensor in deg C + + /** Sample the sensor in deg C * * @returns float value in deg C */ float sample(); - - /* Sample the sensor in deg F + + /** Sample the sensor in deg F * * @returns float value in deg F */ float sample_f(); + +private: + AnalogIn *input_pin_; }; \ No newline at end of file