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.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Temperature.h
00001 #ifndef TEMPERATURE_H 00002 #define TEMPERATURE_H 00003 #include "mbed.h" 00004 #include "LM75B.h" 00005 #include "AbstractReporter.h" 00006 00007 00008 class Temperature: public AbstractReporter 00009 { 00010 public: 00011 Temperature(): deviceReady(false), oldValue(0), 00012 timer(), sensor(D14, D15) { 00013 timer.start(); 00014 } 00015 virtual ~Temperature() {} 00016 virtual bool init() { 00017 deviceReady = sensor.open(); 00018 return deviceReady; 00019 } 00020 virtual const char* name() const { return "Temp"; } 00021 virtual int read(char*, size_t, char*, size_t); 00022 private: 00023 bool deviceReady; 00024 float oldValue; 00025 Timer timer; 00026 LM75B sensor; 00027 }; 00028 00029 #endif /* TEMPERATURE_H */
Generated on Sat Jul 16 2022 07:10:59 by
1.7.2
