温度センサのテスト
Revision 0:766faeb30b5d, committed 2016-03-20
- Comitter:
- 0cean
- Date:
- Sun Mar 20 10:28:03 2016 +0000
- Commit message:
- ???
Changed in this revision
LM61CIZ.cpp | Show annotated file Show diff for this revision Revisions of this file |
LM61CIZ.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 766faeb30b5d LM61CIZ.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM61CIZ.cpp Sun Mar 20 10:28:03 2016 +0000 @@ -0,0 +1,18 @@ +/** + * LM61CIZ Temperature sensor library + * + * @author Junichi Katsu + * @version 1.0 + * @date 02-April-2015 + * + */ + +#include "mbed.h" +#include "LM61CIZ.h" + +LM61CIZ::LM61CIZ(PinName ain) : _sensor(ain){ +} + +float LM61CIZ::getTemperature(void) { + return( (_sensor * 3.3 - 0.6) / 0.01 ); +} \ No newline at end of file
diff -r 000000000000 -r 766faeb30b5d LM61CIZ.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM61CIZ.h Sun Mar 20 10:28:03 2016 +0000 @@ -0,0 +1,38 @@ +/** + * LM61CIZ Temperature sensor library + * + * @author Junichi Katsu + * @version 1.0 + * @date 02-April-2015 + * + */ + +#ifndef MBED_LM61CIZ_H +#define MBED_LM61CIZ_H + +#include "mbed.h" + +/** LM61CIZ class + * @endcode + */ + +class LM61CIZ { +public: + /** Create a LM61CIZ instance + * + * param AnalogIn pin + * + */ + LM61CIZ(PinName ain); + + /** Read the current temperature value from LM61CIZ sensor + * + */ + float getTemperature(void); +private: + + AnalogIn _sensor; +}; + +#endif // MBED_LM61CIZ_H + \ No newline at end of file