upm  0.2.0
Sensor/Actuator repository for libmraa (v0.6.1)
All Data Structures Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions

C++ API for Grove temperature sensor. More...

Detailed Description

Very basic UPM module for 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;

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 ( )

Get raw value from AIO pin

Returns
the raw value from the ADC
int value ( )

Get the temperature in Celsius from the sensor

Returns
the 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: