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.
Dependents: Mytemperature_Motion
Revision 0:43662c8b01ce, committed 2019-04-21
- Comitter:
- sharifdeens
- Date:
- Sun Apr 21 03:29:08 2019 +0000
- Commit message:
- moisture sensor
Changed in this revision
| moisture_sensor.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/moisture_sensor.h Sun Apr 21 03:29:08 2019 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+//Sensor new class for sensorA
+class moisture_sensor
+
+{
+public:
+
+ moisture_sensor(PinName pin);
+ moisture_sensor();
+ operator float ();
+ float read();
+private:
+//class sets up the AnalogIn pin
+ AnalogIn _pin;
+};
+
+
+moisture_sensor::moisture_sensor(PinName pin) : _pin(pin)
+{
+// _pin(pin) means pass pin to the AnalogIn constructor
+}
+
+float moisture_sensor::read()
+
+{
+//read moisture sensor
+ return _pin.read();
+}
+
+moisture_sensor::operator float ()
+{
+//convert sensor reading to temperature in degrees C
+ return _pin.read();
+}