* AM2321的取温度间隔得大于2s,否则,i2c会不工作了 * SimpleTimer有个bug,会导致两次快速的读温度,现在读温度函数里加了保护 * Blynk有个bug,会导致无法把数据传到服务器 * 现在可以正常工作了

Dependencies:   mbed

Revision:
0:740c1eb2df13
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Blynk_v0_3_7/Blynk/BlynkSimpleUserDefined.h	Thu Jun 23 11:16:14 2016 +0000
@@ -0,0 +1,80 @@
+/**
+ * @file       BlynkSimpleUserManaged.h
+ * @author     Volodymyr Shymanskyy
+ * @license    This project is released under the MIT License (MIT)
+ * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
+ * @date       Jun 2015
+ * @brief
+ *
+ */
+
+#ifndef BlynkSimpleUserManaged_h
+#define BlynkSimpleUserManaged_h
+
+#ifndef BLYNK_INFO_CONNECTION
+#define BLYNK_INFO_CONNECTION "custom"
+#endif
+
+#include <BlynkApiMbed.h>
+#include <Blynk/BlynkProtocol.h>
+
+extern size_t BlynkStreamRead(void* buf, size_t len);
+extern size_t BlynkStreamWrite(const void* buf, size_t len);
+
+class BlynkTransportUserDefined
+{
+public:
+    BlynkTransportUserDefined()
+        : mConn (false)
+    {}
+
+    bool connect() {
+        return mConn = true;
+    }
+
+    void disconnect() { mConn = false; }
+
+    bool connected() {
+        return mConn;
+    }
+
+    size_t read(void* buf, size_t len) {
+        return BlynkStreamRead(buf, len);
+    }
+
+    size_t write(const void* buf, size_t len) {
+        return BlynkStreamWrite(buf, len);
+    }
+
+    size_t available() {
+        return 0;
+    }
+
+private:
+    bool mConn;
+};
+
+class BlynkUserDefined
+    : public BlynkProtocol<BlynkTransportUserDefined>
+{
+    typedef BlynkProtocol<BlynkTransportUserDefined> Base;
+public:
+    BlynkUserDefined(BlynkTransportUserDefined& transp)
+        : Base(transp)
+    {}
+
+    void begin(const char* auth)
+    {
+        Base::begin(auth);
+    }
+
+private:
+};
+
+static BlynkTransportUserDefined _blynkTransport;
+BlynkUserDefined Blynk(_blynkTransport);
+
+#include <BlynkWidgets.h>
+
+#endif
+