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.
Dependencies: 4DGL mbed ConfigFile
Fork of 4DGLtest by
Revision 5:d7c036055841, committed 2014-06-29
- Comitter:
- WillemBraat
- Date:
- Sun Jun 29 11:59:45 2014 +0000
- Parent:
- 4:302c2ac97db9
- Child:
- 6:904d00252480
- Commit message:
- Added Internal Temperature Sensor LM75B
Changed in this revision
| temp.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/temp.cpp Sun Jun 29 11:59:45 2014 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+
+// Read temperature from LM75BD
+
+I2C i2c(p28, p27);//use same pins as KBD
+
+const int addr = 0x90;
+
+int CDU_GetTemp() {
+ char cmd[2];
+
+ cmd[0] = 0x01;
+ cmd[1] = 0x00;
+ i2c.write(addr, cmd, 2);
+
+ cmd[0] = 0x00;
+ i2c.write(addr, cmd, 1);
+ i2c.read(addr, cmd, 2);
+ //convert to Degrees Celsius
+ float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0);
+ return (tmp );
+}
