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.
Diff: main.cpp
- Revision:
 - 0:656742ec86ae
 - Child:
 - 1:7f23dfc59683
 
diff -r 000000000000 -r 656742ec86ae main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 11 22:53:22 2017 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+ 
+ //read register value 
+ 
+I2C i2c(p9, p10);
+ 
+const char reg[1] = {0x0D};
+const char device = 0x3A;
+char data[1];
+ 
+int main() {
+    
+        i2c.write(device,reg,1,true);
+        i2c.read(device,data,1);
+        
+        printf("Result : %d \r\n", data[1]);
+        
+        
+        /*i2c.read(addr,);
+        
+        
+        cmd[0] = 0x01;
+        cmd[1] = 0x00;
+        i2c.write(addr, cmd, 2);
+ 
+        wait(0.5);
+ 
+        cmd[0] = 0x00;
+        i2c.write(addr, cmd, 1);
+        i2c.read(addr, cmd, 2);
+ 
+        float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0);
+        printf("Temp = %.2f\n", tmp);*/
+    
+}
\ No newline at end of file