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:b2168af3001f, committed 2019-12-17
- Comitter:
 - formulas
 - Date:
 - Tue Dec 17 18:15:44 2019 +0000
 - Commit message:
 - irthermo
 
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 | 
diff -r 000000000000 -r b2168af3001f main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 17 18:15:44 2019 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+
+#define IrThermo_Addr (0x5A<<1)
+#define Tamb 0x06
+#define Tobj 0x07
+I2C i2c(D14, D15);
+Serial pc(USBTX, USBRX);
+
+int temperature=0;
+char data_read[2];
+char data_write[1]= {Tobj};
+char data_write1[1]={Tamb};
+char data_add[1]= {(0x2E)};
+
+char counter = 0;
+uint32_t cc=0;
+uint32_t cc1=0;
+int main() {
+    //i2c.start();
+    while(1) {          
+        i2c.write(IrThermo_Addr, data_write, 1, 1);
+        i2c.read(IrThermo_Addr, data_read, 2, 0);
+        temperature = (int) ((int)data_read[1] << 8) | data_read[0];
+        temperature = (temperature * 0.02 - 273.15);
+        pc.printf("Tobj=%d, ",temperature);
+        
+        i2c.write(IrThermo_Addr,data_write1 , 1, 1);
+        i2c.read(IrThermo_Addr, data_read, 2, 0);
+        temperature = (int) ((int)data_read[1] << 8) | data_read[0];
+        temperature = (temperature * 0.02 - 273.15);
+        pc.printf("Tamb=%d\n",temperature);
+        
+    }
+}
+
diff -r 000000000000 -r b2168af3001f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 17 18:15:44 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/aa5281ff4a02 \ No newline at end of file