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
Diff: mbedEndpointResources/MoistureResource.h
- Revision:
- 1:6178b6411293
- Child:
- 2:6eb88bd81529
diff -r 6af0e7b187d9 -r 6178b6411293 mbedEndpointResources/MoistureResource.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbedEndpointResources/MoistureResource.h Mon Apr 27 19:59:03 2015 +0000
@@ -0,0 +1,28 @@
+#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
\ No newline at end of file
