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.
main.cpp
00001 #include "mbed.h" 00002 #include "DS1820.h" 00003 00004 Serial pc(SERIAL_TX, SERIAL_RX); 00005 00006 const int MAX_PROBES = 3; 00007 DS1820 probe[3] = {D2, D2, D2}; 00008 00009 00010 int main() 00011 { 00012 int i; 00013 int devices_found=0; 00014 00015 //pc.attach(&pcRx, pc.RxIrq); 00016 pc.printf("Started\r\n"); 00017 00018 pc.printf("search_ROM_setup\r\n"); 00019 probe[0].search_ROM_setup(); 00020 pc.printf("search_ROM\r\n"); 00021 while (probe[devices_found].search_ROM() and devices_found<MAX_PROBES-1) 00022 devices_found++; 00023 00024 // If maximum number of probes are found, 00025 // bump the counter to include the last array entry 00026 if (probe[devices_found].ROM[0] != 0xFF) 00027 devices_found++; 00028 pc.printf("devices found:%d\r\n", devices_found); 00029 00030 00031 while(1) { 00032 probe[0].convert_temperature(DS1820::all_devices); 00033 for (i=0; i<devices_found; i++) { 00034 pc.printf("Device[%d]: %3.1f \r\n",i, probe[i].temperature('c')); 00035 } 00036 wait(1.0); // 1 sec 00037 } 00038 }
Generated on Tue Jul 12 2022 23:18:02 by
1.7.2