sensore digitale di temperatura

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mariangelamone
Date:
Sat Jan 29 16:53:42 2022 +0000
Parent:
2:b369cd116bf1
Commit message:
DS18B20

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Nov 17 21:55:04 2015 +0000
+++ b/main.cpp	Sat Jan 29 16:53:42 2022 +0000
@@ -1,12 +1,9 @@
+
 #include "mbed.h"
 #include "DS1820.h"
-
 Serial pc(SERIAL_TX, SERIAL_RX);
-
 const int MAX_PROBES = 1;
 DS1820 probe[1] = {A0};
-
-
 int main()
 {
     int i;
@@ -31,7 +28,11 @@
     while(1) {
         probe[0].convert_temperature(DS1820::all_devices);
         for (i=0; i<devices_found; i++) {
-            pc.printf("Device[%d]: %3.1f \r\n",i, probe[i].temperature('f'));
+          //  pc.printf("Device[%d]: %3.1f \r\n",i, probe[i].temperature('f'));
+           float t=probe[i].temperature('f');
+           float tc=(t-32)/1.8; //da Farenheit a Celsius
+            pc.printf("Device[%d]: %3.1f \r\n",i, t);
+             pc.printf("Device[%d]: %3.1f \r\n",i, tc);  
         }
         wait(1); // 1 sec
     }