#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include <aliyun_mqtt.h>
#define WIFI_SSID "Tenda_12E9E0"
#define WIFI_PASSWD "88889999"
// 阿里云三元组
#define PRODUCT_KEY "a1ZJp7eq1cW"
#define DEVICE_NAME "my_flowerpot"
#define DEVICE_SECRET "FKoFPqwLjchgWCguYdXt9dYd7OPzlKRN"
#define ALINK_BODY_FORMAT "{\"id\":\"%u\",\"version\":\"1.0\",\"method\":\"%s\",\"params\":%s}" // 消息体字符串格式
#define ALINK_TOPIC_PROP_POST "/sys/" PRODUCT_KEY "/" DEVICE_NAME "/thing/event/property/post" //发布,设备属性上报
#define ALINK_TOPIC_PROP_SET "/sys/" PRODUCT_KEY "/" DEVICE_NAME "/thing/service/property/set" //订阅,设备属性设置
#define ALINK_METHOD_PROP_POST "thing.event.property.post" //设备属性上报,作为上面发布订阅消息体的method参数
const int LED = D2;
const int BUTTON = D6;
int ledState = HIGH; // the current state of the output pin
int previous = LOW; // the previous reading from the input pin 记录开关的上一次状态
// the follow variables are long's because the time, measured in miliseconds,
// w