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
LDR_sensor.h
00001 #include "mbed.h" 00002 00003 //Sensor new class for sensorA 00004 class LDR_sensor 00005 00006 { 00007 public: 00008 00009 LDR_sensor(PinName pin2); 00010 LDR_sensor(); 00011 operator float (); 00012 float read(); 00013 private: 00014 //class sets up the AnalogIn pin 00015 AnalogIn _pin2; 00016 }; 00017 00018 00019 LDR_sensor::LDR_sensor(PinName pin2) : _pin2(pin2) 00020 { 00021 // _pin(pin) means pass pin to the AnalogIn constructor 00022 } 00023 00024 float LDR_sensor::read() 00025 00026 { 00027 //read moisture sensor 00028 return _pin2.read(); 00029 } 00030 00031 LDR_sensor::operator float () 00032 { 00033 //convert sensor reading to temperature in degrees C 00034 return _pin2.read(); 00035 }
Generated on Tue Jul 12 2022 15:29:27 by
1.7.2