Wemos D1 mini阿里云MQTT例程
【文件目录】test10├── IRremote.h
├── IRremoteInt.h
├── NTPClient.cpp
├── NTPClient.h
├── PubSubClient.cpp
├── PubSubClient.h
├── log
└── test10.ino
1 directory, 7 files
#include <ESP8266WiFi.h>#include "PubSubClient.h"
#include <ArduinoJson.h>
//============================
#include "NTPClient.h"
#include <WiFiUdp.h>
//===========================
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
//---------------------------------
#define SENSOR_PIN 13
#define WIFI_SSID "testwifi1"
#define WIFI_PASSWD "12345678"
//#define WIFI_SSID "内容部1号"
//#define WIFI_PASSWD "123456"
#define PRODUCT_KEY "a1LMjoPJ8gR"
#define DEVICE_NAME "DanYi4_App1"
#define DEVICE_SECRET "aDK18T3A1sfRTt7w0SUtXCnhX3x6Hj"
#define MQTT_SERVER "a1LMjoPJ8gR.iot-as-mqtt.cn-shanghai.aliyuncs.com"
#define MQTT_PORT 1883
#define MQTT_USRNAME "DanYi4_App1&a1LMjoPJ8gR"
#define CLIENT_ID "DanYi4_App1|securemode=3,signmethod=hmacsha1|"
#define MQTT_PASSWD "85EB395DBF5D1CE6EC798E5EDA5F9449E6A379F3"
#define ALINK_TOPIC_PROP_POST "/a1LMjoPJ8gR/DanYi4_App1/user/update"
#define ALINK_TOPIC_PROP_subscribe "/a1LMjoPJ8gR/DanYi4_App1/user/get"
#define REGION_ID "cn-shanghai"
#define ALINK_BODY_FORMAT "{\"id\":\"123\",\"version\":\"1.0\",\"method\":\"thing.event.property.post\",\"params\":%s}"
评论