![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
temperature sensor with uOLED 96 g1 & GSM Support
Dependencies: OLED160G1 mbed uOLED
Fork of DS18B20 by
Diff: DS18B20.cpp
- Revision:
- 1:b2ea1e9d90df
- Parent:
- 0:03ec282c2908
--- a/DS18B20.cpp Fri Jan 29 19:01:56 2010 +0000 +++ b/DS18B20.cpp Wed Oct 31 12:26:00 2012 +0000 @@ -6,6 +6,7 @@ // Device byte commands over 1-wire serial enum COMMANDS { READ_ROM = 0x33, CONVERT = 0x44, READ_SCRATCHPAD = 0xBE, SKIP_ROM = 0xCC }; + // device onboard register layout typedef struct { uint8_t LSB; @@ -76,11 +77,12 @@ } // temperature is store as 7.4 fixed point format (assuming 12 bit conversion) -void displayTemperature(Serial& s) { +void showTemperature(float *f) { DoConversion(); uint32_t temp = GetTemperature(); - float f = (temp & 0x0F) * 0.0625; // calculate .4 part - f += (temp >> 4); // add 7.0 part to it - s.printf("Temp is %2.1fC\n\r", f); // display in 2.1 format + *f = (temp & 0x0F) * 0.0625; // calculate .4 part + *f += (temp >> 4); // add 7.0 part to it + //return(f); + //s.printf("Temp is %2.1fC\n\r", f); // display in 2.1 format }