MEM / Mbed 2 deprecated ES_3_P5

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Mattinico
Date:
Mon Oct 17 18:04:25 2016 +0000
Commit message:
hh

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	Mon Oct 17 18:04:25 2016 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+I2C i2c(D14, D15);
+const int addr=0x90;
+int main() {
+    char cmd[2];
+    printf("\r\nTCN75 I2C thermometer\r\n");
+    cmd[0]=0x01;
+    cmd[0]=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 = cmd[0]<<8|cmd[1];
+        printf("Temperatue = %.4f C\r\n", temp/256);
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 17 18:04:25 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file