Dallas' DS1820 family temperature sensor using mbed debug logs.
Fork of DS1820 by
DS1820.h
- Committer:
- Lucian Corduneanu
- Date:
- 2018-05-02
- Revision:
- 17:325cd3a6cbbb
- Parent:
- 16:0764e4de41d2
File content as of revision 17:325cd3a6cbbb:
#ifndef DS1820_H_ #define DS1820_H_ #include <OneWire.h> #include "mbed_debug.h" #define DEBUG 0 class DS1820 { OneWire oneWire; bool present; bool model_s; uint8_t data[12]; uint8_t addr[8]; public: DS1820(PinName pin); DS1820(char model, PinName pin); bool begin(void); bool isPresent(); void setResolution(uint8_t res); virtual void startConversion(void); virtual uint8_t readRaw(uint16_t &temp); uint8_t read(float &temp); protected: float toFloat(uint16_t word); }; #endif /* DS1820_H_ */