A simple WIP that logs data from a Grove sensor, and can send and receive information over USB and SMS.

Dependencies:   DHT DS_1337 SDFileSystem USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

GroveDht22 Class Reference

GroveDht22 Class Reference

The GroveDht22 class handles the interface to the DHT22 humidity and temperature sensor. More...

#include <GroveDht22.h>

Inherits AbstractHandler.

Public Member Functions

void run ()
 run is inherited by each Handler class. It is called from the main while loop in main.cpp. It runs through the state machine, specific to each Handler class.
void setRequest (int request, void *data=0)
 setRequest sets a request that the handler will complete when it is able to

Protected Attributes

MyTimersm_timer
 Handler classes use timers to pause in the state machine, and continue after delay has finished.

Detailed Description

The GroveDht22 class handles the interface to the DHT22 humidity and temperature sensor.

The state machine checks for errors and retries and will power cycle the sensor if there are GROVE_NUM_RETRIES number of retries.

The state machine also ensures that at least two seconds is left between readings.

At any time the parent class can access the last good readings, or the last error.

The newInfo flag exists so that the parent can decide to only notify (print to terminal or otherwise) when there is new information available. Calling the newInfo getter will clear the newInfo flag.

Definition at line 33 of file GroveDht22.h.


Member Function Documentation

void run (  ) [virtual]

run is inherited by each Handler class. It is called from the main while loop in main.cpp. It runs through the state machine, specific to each Handler class.

Implements AbstractHandler.

Definition at line 27 of file GroveDht22.cpp.

void setRequest ( int  request,
void *  data = 0 
) [virtual]

setRequest sets a request that the handler will complete when it is able to

Parameters:
requestunique to the reimplemented class (an enum) that will be completed in the state machine
messagean optional array of information relevant to the request

Implements AbstractHandler.

Definition at line 100 of file GroveDht22.cpp.


Field Documentation

MyTimers* m_timer [protected, inherited]

Handler classes use timers to pause in the state machine, and continue after delay has finished.

Definition at line 31 of file AbstractHandler.h.