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.
Dependents: BLE_nRF24L01 frdm_serialfgmp gather_sensor_data UltiSaverController ... more
Diff: DS1820.h
- Revision:
 - 14:b02fa18b294a
 - Parent:
 - 13:b593a82ce790
 - Child:
 - 20:98c261bcb399
 
diff -r b593a82ce790 -r b02fa18b294a DS1820.h
--- a/DS1820.h	Wed Oct 28 18:05:51 2015 +0000
+++ b/DS1820.h	Sun Jan 20 10:11:31 2019 +0000
@@ -3,6 +3,39 @@
 
     #include <OneWire.h>
 
+/**
+ * Dallas' DS1820 family temperature sensor.
+ * This library depends on the OneWire library (Dallas' 1-Wire bus protocol implementation)
+ * available at <http://developer.mbed.org/users/hudakz/code/OneWire/>
+ *
+ * Example of use:
+ * 
+ * @code
+ * #include "DS1820.h"
+ *
+ * Serial serial(USBTX, USBRX);
+ * 
+ * int main() {
+ *     DS1820  ds1820(PA_9);    // substitute PA_9 with actual mbed pin name connected to the DS1820 data pin
+ *
+ *     if(ds1820.begin()) {
+ *        ds1820.startConversion();
+ *        wait(1.0);
+ *        while(1) {
+ *            serial.printf("temp = %3.1f\r\n", ds1820.read());     // read temperature
+ *            ds1820.startConversion();     // start temperature conversion
+ *            wait(1.0);                    // let DS1820 complete the temperature conversion
+ *        }
+ *    } else
+ *        serial.printf("No DS1820 sensor found!\r\n");
+ * }
+ *
+ * @endcode
+ * 
+ * Note: Don't forget to connect a 4.7k Ohm resistor 
+ *       between the DS1820's data pin and the +3.3V pin
+ *
+ */
 class   DS1820
 {
     OneWire oneWire;