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

API for the Grove Temperature Sensor. More...

Detailed Description

Basic UPM module for the Grove temperature sensor on analog

// Create the temperature sensor object using AIO pin 0
std::cout << temp->name() << std::endl;
// Read the temperature ten times, printing both the Celsius and
// equivalent Fahrenheit temperature, waiting one second between readings
for (int i=0; i < 10; i++) {
int celsius = temp->value();
int fahrenheit = (int) (celsius * 9.0/5.0 + 32.0);
printf("%d degrees Celsius, or %d degrees Fahrenheit\n",
celsius, fahrenheit);
sleep(1);
}
// Delete the temperature sensor object
delete temp;
grovetemp.jpg

Public Member Functions

 GroveTemp (unsigned int pin)
 
 ~GroveTemp ()
 
float raw_value ()
 
int value ()
 
- Public Member Functions inherited from Grove
std::string name ()
 

Additional Inherited Members

- Protected Attributes inherited from Grove
std::string m_name
 

Constructor & Destructor Documentation

GroveTemp ( unsigned int  pin)

Grove analog temperature sensor constructor

Parameters
pinAnalog pin to use
~GroveTemp ( )

GroveTemp destructor

Member Function Documentation

float raw_value ( )

Gets the raw value from the AIO pin

Returns
Raw value from the ADC
int value ( )

Gets the temperature in Celsius from the sensor

Returns
Normalized temperature in Celsius
Inheritance diagram for GroveTemp:
Inheritance graph
[legend]
Collaboration diagram for GroveTemp:
Collaboration graph
[legend]

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