Erriez LM35 library for Arduino  1.1.0
This is a LM35 analog temperature sensor library for Arduino.
Public Member Functions | List of all members
LM35 Class Reference

LM35 sensor class. More...

#include <ErriezLM35.h>

Public Member Functions

 LM35 (uint8_t pin)
 LM35 constructor. More...
 
uint16_t readTemperature ()
 Read unsigned analog temperature. More...
 

Detailed Description

LM35 sensor class.

Definition at line 49 of file ErriezLM35.h.

Constructor & Destructor Documentation

◆ LM35()

LM35::LM35 ( uint8_t  pin)
explicit

LM35 constructor.

The constructor changes the ADC to 1.1V internal ADC reference voltage for higher accuracy. This affects all ANALOG pins.

Parameters
pinLM35 analog pin.

Definition at line 42 of file ErriezLM35.cpp.

Member Function Documentation

◆ readTemperature()

uint16_t LM35::readTemperature ( )

Read unsigned analog temperature.

Sample LM35 analog pin multiple times to find two identical samples to reduce noise. A maximum number of samples can be configured with macro LM35_MAX_SAMPLES. The last sampled temperature will be returned when no identical temperatures found.

Temperature range: 0.0 .. 110 degree Celsius: A negative temperature cannot be measured, because the ADC pin can only sample between positive 0.0 and 1.1 Volt.

Returns
Divide temperature by 10 to get the temperature integer, temperature modulo 10 results in the fraction, for example: int16_t temperature = 182 means 18.2 degree Celsius.

Definition at line 75 of file ErriezLM35.cpp.


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