Grove temperature sensor library
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 |
diff -r 7e6f5d859469 -r 2d65df11758a Grove_temp_sensor.cpp --- 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(); +}
diff -r 7e6f5d859469 -r 2d65df11758a Grove_temp_sensor.h --- 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;