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:1a9f04f52745, committed 2015-12-25
- Comitter:
- de_geeter_alexander
- Date:
- Fri Dec 25 20:41:34 2015 +0000
- Commit message:
- With this libary you can read the temperatuur of the I2C sensor of the appboard.
Changed in this revision
| TemperatureSensor.cpp | Show annotated file Show diff for this revision Revisions of this file |
| TemperatureSensor.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TemperatureSensor.cpp Fri Dec 25 20:41:34 2015 +0000
@@ -0,0 +1,22 @@
+#include "MbedJSONValue.h"
+#include "TemperatureSensor.h"
+
+TemperatureSensor::TemperatureSensor(PinName SDA, PinName SCL, std::string key, std::string name) :
+ LM75B(SDA, SCL)
+{
+ this->key=key;
+ this->name=name;
+
+}
+
+std::string TemperatureSensor::getDataPacket(void)
+{
+ char buffer[100];
+ MbedJSONValue jstring;
+ jstring["data"][0]=name;
+ jstring["data"][1]=key;
+ jstring["data"][2]=temp();
+ std::string s = jstring.serialize();
+ return s;
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TemperatureSensor.h Fri Dec 25 20:41:34 2015 +0000
@@ -0,0 +1,18 @@
+#ifndef TEMPERATURESENSOR_H
+#define TEMPERATURESENSOR_H
+
+#include "LM75B.h"
+#include <string>
+
+class TemperatureSensor : public LM75B
+{
+public:
+ TemperatureSensor(PinName SDA, PinName SCL, std::string key, std::string name);
+ std::string getDataPacket(void);
+private:
+ std::string name;
+ std::string key;
+
+};
+
+#endif
\ No newline at end of file