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.
Revision 0:72fc8166a8ae, committed 2022-01-18
- Comitter:
- domemort
- Date:
- Tue Jan 18 17:01:14 2022 +0000
- Commit message:
- .;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file | 
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file | 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 18 17:01:14 2022 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+
+I2C          i2c(D14, D15);
+Serial       pc(USBTX, USBRX);
+const int    addr = 0x48<<1;
+
+int main (){
+    i2c.frequency(100000);
+    char cmd[2];
+    pc.printf("\r\nTCN75 I2C thermometer\r\n");
+    cmd[0] = 0x01;
+    cmd[1] = 0x00;
+    i2c.write(addr, cmd, 2);
+       while(1) {
+           wait(1);
+           cmd[0] = 0x00;
+           i2c.write(addr, cmd, 1);
+           i2c.read(addr, cmd, 2);
+           float temp = 0.0625f*((cmd[0]<<8 | cmd[1])>>4);
+           pc.printf("Temperature = %.4f C\r\n", temp);
+           }    
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jan 18 17:01:14 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file