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: LM75B.cpp
- Revision:
- 0:c622220fe79d
diff -r 000000000000 -r c622220fe79d LM75B.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.cpp Mon Mar 14 13:30:16 2016 +0000
@@ -0,0 +1,19 @@
+#include "LM75B.h"
+
+LM75B :: LM75B(PinName sda, PinName scl) : i2c(sda, scl)
+{
+ cmd[0] = LM75B_CONF; // Pointerregister
+ cmd[1] = 0x0; // Default siehe 7.4.2 Tabelle 8
+ i2c.write(LM75B_ADDR, cmd, 2); // Adr., char *, Länge
+}
+
+float LM75B :: read()
+{
+ cmd[0] = LM75B_TEMP;
+
+ i2c.write(LM75B_ADDR, cmd, 1); // sende Temperatur Befehl
+ i2c.read(LM75B_ADDR, cmd, 2); // bekommmen den command string
+ return (float ((cmd[0] << 8) | cmd[1])/256.0);
+}
+
+LM75B :: ~LM75B() {}
\ No newline at end of file