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:
- jiwu14
- Date:
- 2015-04-27
- Revision:
- 1:6178b6411293
- Child:
- 2:6eb88bd81529
File content as of revision 1:6178b6411293:
#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,"Slider", SN_GRS_GET_ALLOWED,observable) {
}
virtual string get() {
char moisture_lvl[7];
memset(moisture_lvl,0,7);
sprintf(moisture_lvl,"%3.2f", moisture_in.read());
return string(moisture_lvl);
}
};
#endif
