DS18b20 example
Dependencies: DS1820 mbed-STM32F103C8T6 mbed
Diff: main.cpp
- Revision:
- 5:0281a22f3cc7
- Parent:
- 3:f483abe4bc57
--- a/main.cpp Fri Jan 13 18:30:37 2017 +0000 +++ b/main.cpp Fri Nov 09 04:28:18 2018 +0000 @@ -3,15 +3,16 @@ #ifdef MULTIPLE_PROBES - +#include "stm32f103c8t6.h" #include "mbed.h" #include "DS1820.h" #define MAX_PROBES 16 - + DS1820* probe[MAX_PROBES]; - -int main() { + +int main() +{ // Initialize the probe array to DS1820 objects int num_devices = 0; while(DS1820::unassignedProbe(DATA_PIN)) { @@ -20,7 +21,7 @@ if (num_devices == MAX_PROBES) break; } - + printf("Found %d device(s)\r\n\n", num_devices); while(1) { probe[0]->convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready @@ -29,16 +30,18 @@ printf("\r\n"); wait(1); } - + } #else +#include "stm32f103c8t6.h" #include "mbed.h" #include "DS1820.h" - + DS1820 probe(DATA_PIN); - -int main() { + +int main() +{ while(1) { probe.convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready printf("It is %3.1foC\r\n", probe.temperature());