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.
Fork of I2C_MCP9808_V2 by
Revision 1:4255a3b6fae8, committed 2018-11-05
- Comitter:
- csoulen
- Date:
- Mon Nov 05 14:23:50 2018 +0000
- Parent:
- 0:80fb3c4621be
- Commit message:
- ben
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 80fb3c4621be -r 4255a3b6fae8 main.cpp
--- a/main.cpp Tue Oct 23 19:39:34 2018 +0000
+++ b/main.cpp Mon Nov 05 14:23:50 2018 +0000
@@ -15,7 +15,7 @@
// Note MCP9808 also needs VCC (3.3 V) and GND
float TempValue;
-float data[20];
+float data[20],data_f[20];
char data_write[3], data_read[2];
int ii, status;
int main() {
@@ -54,10 +54,11 @@
data_read[0] = data_read[0] & 0x1F; // clear flag bits for temperature
data[i] = (data_read[0] * 16) + (data_read[1] / 16.0); // combine two bytes
+ data_f[i] = (data[i]+40)*9/5-40;
// Display the flags, if you wish
// pc.printf("Flags are %i \n\r",status);
// This displays to the user
- pc.printf("%i Temperature is %3.1f\n\r",i,data[i]);
+ pc.printf("%i Temperature is %3.1f C and %3.1f F\n\r",i,data[i],data_f[i]);
i=i+1;
wait(1);
}
