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.
Dependencies: DS18B20Sensor mbed
main.cpp
00001 #include "mbed.h" 00002 #include "DS18B20Sensor.h" 00003 00004 // Instantiate sensor with hardware in pin p30 00005 DS18B20Sensor sensor(PTB4); 00006 00007 // Setup a window to the world 00008 //Serial pc(p13, p14); 00009 Serial pc(USBTX, USBRX); 00010 00011 int main() 00012 { 00013 char sensorBuf[25]; 00014 00015 // count will search for sensors, if not already called 00016 pc.printf("Found %d sensor/s\r", sensor.count()); 00017 00018 uint8_t result = sensor.startReading(true); // start sensor readings and wait 00019 00020 for (uint8_t i = 0; i < sensor.count(); i++) { 00021 sensor.getReading(sensorBuf, i); // get result into buf 00022 pc.printf("Sensor %d : %s\r", i+1, sensorBuf); // display it to the world 00023 } 00024 00025 }
Generated on Mon Jul 18 2022 21:10:47 by
1.7.2