Library for reading temperature from DS1820, DS18B20 and DS1822
Dependents: heatmap BLE_Temperature BLE_Temperature_Exercise F334andDS18B20 ... more
Fork of DS1820 by
HelloWorld: http://mbed.org/users/Sissors/code/DS1820_HelloWorld/
Library should currently work on all mbed targets, let me know if there is an issue. First however make sure you have latest version of mbed library and this library.
Diff: DS1820.cpp
- Revision:
- 12:196e9e54b033
- Parent:
- 11:1a3c3002b50c
- Child:
- 14:c591209285e9
--- a/DS1820.cpp Mon Feb 16 16:53:11 2015 +0000 +++ b/DS1820.cpp Thu Feb 26 22:20:24 2015 +0000 @@ -117,9 +117,10 @@ } else { ROM_bit_index=1; descrepancy_marker=0; + char command_shift = command; for (int n=0; n<8; n++) { // Search ROM command or Search Alarm command - onewire_bit_out(pin, command & 0x01); - command = command >> 1; // now the next bit is in the least sig bit position. + onewire_bit_out(pin, command_shift & 0x01); + command_shift = command_shift >> 1; // now the next bit is in the least sig bit position. } byte_counter = 0; bit_mask = 0x01;