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:519691976fbc, committed 2020-07-18
- Comitter:
- qaz
- Date:
- Sat Jul 18 08:23:26 2020 +0000
- Commit message:
- dasfd
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 Sat Jul 18 08:23:26 2020 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+// Read temperatures from Grid-EYE
+// note i2c stuff does not need a special ,h file
+
+I2C i2c(PTE0, PTE1);
+
+const int addr = 0x90;
+
+int main() {
+ char cmd[2];
+ while (1) {
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jul 18 08:23:26 2020 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file