Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 6 months ago. This question has been closed. Reason: Opinion based - no single answer
Why does DS18B20 lib hate Serial?
Hi I am trying to read temp from DS18B20 water proof sensor using sample code from https://developer.mbed.org/components/DS1820/
Here is it:
include the mbed library with this snippet
#include "mbed.h" #include "DS1820.h" DS1820 probe(P0_4); //BLE Nano Analog Pin Serial pc(P0_9, P0_11); // tx, rx on ble nano int main() { pc.baud(19200); while(1) { //probe.convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready //printf("It is %3.1foC\r\n", probe.temperature()); wait(1); pc.printf("Hello World\n"); } }
If I comment line: DS1820 probe(P0_4); BLE Nano Analog Pin
I can see "Hello World" through USB port, but if I leave it as is "Hello World" is never showed.
What is happening?
Thanks a lot
Alex