Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbedConnectorInterface mbedEndpointNetwork
mbedEndpointResources/MoistureResource.h
- Committer:
- JasonSwanson
- Date:
- 2015-05-01
- Revision:
- 5:abbad7ddc804
- Parent:
- 3:3281ef00910f
- Child:
- 7:5cd21d0ff21f
File content as of revision 5:abbad7ddc804:
#ifndef __MOISTURE_RESOURCE_H__
#define __MOISTURE_RESOURCE_H__
// Base class
#include "DynamicResource.h"
//Analog in moisture sensor
AnalogIn moisture_in(A0);
/** Moisture Resource **/
class MoistureResource : public DynamicResource {
public:
/**
Default constructor
@param logger input logger instance for this resource
@param name input the resource name
@param observable input the resource is Observable (default: FALSE)
*/
MoistureResource(const Logger *logger,const char *name,const bool observable = false) : DynamicResource(logger,name,"Moisture", SN_GRS_GET_ALLOWED,observable) {
}
virtual string get() {
char moisture_lvl[7];
memset(moisture_lvl,0,7);
sprintf(moisture_lvl,"%1.4f", moisture_in.read());
return string(moisture_lvl);
}
};
#endif
