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

Dependencies:   mbed

Committer:
lixianyu
Date:
Fri Jun 24 02:06:43 2016 +0000
Revision:
1:e34100dd6532
Parent:
0:740c1eb2df13
?Arduino??????????0~255??????LPC824????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lixianyu 0:740c1eb2df13 1 /**
lixianyu 0:740c1eb2df13 2 * @file WidgetLCD.h
lixianyu 0:740c1eb2df13 3 * @author Volodymyr Shymanskyy
lixianyu 0:740c1eb2df13 4 * @license This project is released under the MIT License (MIT)
lixianyu 0:740c1eb2df13 5 * @copyright Copyright (c) 2015 Volodymyr Shymanskyy
lixianyu 0:740c1eb2df13 6 * @date Mar 2015
lixianyu 0:740c1eb2df13 7 * @brief
lixianyu 0:740c1eb2df13 8 */
lixianyu 0:740c1eb2df13 9
lixianyu 0:740c1eb2df13 10 #ifndef WidgetLCD_h
lixianyu 0:740c1eb2df13 11 #define WidgetLCD_h
lixianyu 0:740c1eb2df13 12
lixianyu 0:740c1eb2df13 13 #include <Blynk/BlynkApi.h>
lixianyu 0:740c1eb2df13 14
lixianyu 0:740c1eb2df13 15 class WidgetLCD
lixianyu 0:740c1eb2df13 16 {
lixianyu 0:740c1eb2df13 17 public:
lixianyu 0:740c1eb2df13 18 WidgetLCD(uint8_t pin) : mPin(pin) {}
lixianyu 0:740c1eb2df13 19 void setVPin(int vPin) { mPin = vPin; }
lixianyu 0:740c1eb2df13 20
lixianyu 0:740c1eb2df13 21 void clear() {
lixianyu 0:740c1eb2df13 22 Blynk.virtualWrite(mPin, "clr");
lixianyu 0:740c1eb2df13 23 }
lixianyu 0:740c1eb2df13 24
lixianyu 0:740c1eb2df13 25 template<typename T>
lixianyu 0:740c1eb2df13 26 void print(int x, int y, const T& str) {
lixianyu 0:740c1eb2df13 27 char mem[64] = "";
lixianyu 0:740c1eb2df13 28 BlynkParam cmd(mem, 0, sizeof(mem));
lixianyu 0:740c1eb2df13 29 cmd.add("p");
lixianyu 0:740c1eb2df13 30 cmd.add(x);
lixianyu 0:740c1eb2df13 31 cmd.add(y);
lixianyu 0:740c1eb2df13 32 cmd.add(str);
lixianyu 0:740c1eb2df13 33 Blynk.virtualWrite(mPin, cmd);
lixianyu 0:740c1eb2df13 34 }
lixianyu 0:740c1eb2df13 35
lixianyu 0:740c1eb2df13 36 private:
lixianyu 0:740c1eb2df13 37 uint8_t mPin;
lixianyu 0:740c1eb2df13 38 };
lixianyu 0:740c1eb2df13 39
lixianyu 0:740c1eb2df13 40 #endif
lixianyu 0:740c1eb2df13 41