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: Grove_Temp_Hello_world
Revision 6:2d65df11758a, committed 2016-03-10
- Comitter:
- peipei123
- Date:
- Thu Mar 10 20:16:10 2016 +0000
- Parent:
- 4:7e6f5d859469
- Commit message:
- 1
Changed in this revision
| Grove_temp_sensor.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Grove_temp_sensor.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Grove_temp_sensor.cpp Thu Mar 10 19:39:43 2016 +0000
+++ b/Grove_temp_sensor.cpp Thu Mar 10 20:16:10 2016 +0000
@@ -28,3 +28,8 @@
double temperature=1/(log(resistance/10000)/3975+1/298.15)-276.05;
return temperature;
}
+
+float Grove_temp_sensor::operator= (Grove_temp_sensor& rhs) {
+
+ return rhs.read_C();
+}
--- a/Grove_temp_sensor.h Thu Mar 10 19:39:43 2016 +0000
+++ b/Grove_temp_sensor.h Thu Mar 10 20:16:10 2016 +0000
@@ -25,6 +25,13 @@
* @param returns temperature
*/
float read_C();
+
+ /** Shorthand to read the temperature value.
+ *
+ * @param returns temperature in Celsius
+ */
+ float operator= (Grove_temp_sensor& rhs);
+
private:
//class sets up the AnalogIn pin
AnalogIn _pin;
Grove Temperature Sensor