Fork of http://developer.mbed.org/users/Michael_/code/DS1820/ Basically an identical copy, only differences are CRC renamed to xCRC and datapin has PullUp enabled.
Fork of ds18b20_test by
Diff: main.cpp
- Revision:
- 2:1592885925f4
- Parent:
- 1:10bbb8a13329
--- a/main.cpp Thu Mar 27 17:26:59 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -#include "mbed.h" -#include "DS1820.h" - -Serial pc(SERIAL_TX, SERIAL_RX); - -const int MAX_PROBES = 3; -DS1820 probe[3] = {D2, D2, D2}; - - -int main() -{ - int i; - int devices_found=0; - - //pc.attach(&pcRx, pc.RxIrq); - pc.printf("Started\r\n"); - - pc.printf("search_ROM_setup\r\n"); - probe[0].search_ROM_setup(); - pc.printf("search_ROM\r\n"); - while (probe[devices_found].search_ROM() and devices_found<MAX_PROBES-1) - devices_found++; - - // If maximum number of probes are found, - // bump the counter to include the last array entry - if (probe[devices_found].ROM[0] != 0xFF) - devices_found++; - pc.printf("devices found:%d\r\n", devices_found); - - - while(1) { - probe[0].convert_temperature(DS1820::all_devices); - for (i=0; i<devices_found; i++) { - pc.printf("Device[%d]: %3.1f \r\n",i, probe[i].temperature('c')); - } - wait(1.0); // 1 sec - } -}