Tyler Weaver / TMP36 GZ

Dependents:   HARP2 HARP3 Thermostat_NucleoF401 4180Lab4_p1 ... more

Embed: (wiki syntax)

« Back to documentation index

TMP36GZ Class Reference

TMP36GZ Class Reference

TMP36GZ temperature sensor class. More...

#include <TMP36GZ.h>

Public Member Functions

 TMP36GZ (PinName pin)
 Constructor for TMP36GZ sensor.
float sample ()
 Sample the sensor in deg C.
float sample_f ()
 Sample the sensor in deg F.

Detailed Description

TMP36GZ temperature sensor class.

Author:
Tyler Weaver

Example:

 #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
     }
 }

DESCRIPTION

C++ file for TMP36GZ temperature sensor library

/----\ |1 2 3 | --------

1 - Vs, connect 3.3V (Vout) 2 - Vout - connect to input pin 3 - GND - connect to ground

750mV = 25 deg/C

10mV / deg/C

Definition at line 61 of file TMP36GZ.h.


Constructor & Destructor Documentation

TMP36GZ ( PinName  pin )

Constructor for TMP36GZ sensor.

Analog input pin from p15-p20

Parameters:
pinthe analog input pin (connect to pin 2 on sensor)

Definition at line 22 of file TMP36GZ.cpp.


Member Function Documentation

float sample (  )

Sample the sensor in deg C.

Returns:
float value in deg C

Definition at line 27 of file TMP36GZ.cpp.

float sample_f (  )

Sample the sensor in deg F.

Returns:
float value in deg F

Definition at line 32 of file TMP36GZ.cpp.