* AM2321的取温度间隔得大于2s,否则,i2c会不工作了 * SimpleTimer有个bug,会导致两次快速的读温度,现在读温度函数里加了保护 * Blynk有个bug,会导致无法把数据传到服务器 * 现在可以正常工作了
Blynk_v0_3_7/Blynk/BlynkSimpleUserDefined.h
- Committer:
- lixianyu
- Date:
- 2016-06-23
- Revision:
- 0:740c1eb2df13
File content as of revision 0:740c1eb2df13:
/** * @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