upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | Protected Attributes

API for the DFRobot LM35 Linear Temperature Sensor. More...

Detailed Description

This sensor returns an analog voltage proportional to the temperature of the ambient environment.

It has a range of 2C to 150C.

This driver was developed using the DFRobot LM35 Linear Temperature Sensor

// Instantiate a LM35 on analog pin A0, with a default analog
// reference voltage of 5.0
upm::LM35 *sensor = new upm::LM35(0);
// Every half second, sample the sensor and output the temperature
while (shouldRun)
{
cout << "Temperature: " << sensor->getTemperature() << " C" << endl;
usleep(500000);
}

Public Member Functions

 LM35 (int pin, float aref=5.0)
 
 ~LM35 ()
 
float getTemperature ()
 

Protected Attributes

mraa::Aio m_aio
 

Constructor & Destructor Documentation

LM35 ( int  pin,
float  aref = 5.0 
)

LM35 constructor

Parameters
pinAnalog pin to use
arefAnalog reference voltage; default is 5.0 V
~LM35 ( )

LM35 destructor

Member Function Documentation

float getTemperature ( void  )

Returns the temperature in degrees Celcius

Returns
The Temperature in degrees Celcius

The documentation for this class was generated from the following files: