自动配网改完就验证不过了-Arduino中文社区 - Powered by Discuz! Archiver

f969439474 发表于 2021-5-16 20:29

自动配网改完就验证不过了

这是控制空调的,我照着这个自动配网改完后,
验证的时候就通不过,有大佬帮忙看一下吗?感谢

#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <Blinker.h>
#define BLINKER_ESP_SMARTCONFIG

char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";

//定义红外发射的管脚
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.

/*美的空调红外键值读取*/

//空调开
uint16_t power_on = {6166, 7384,540, 562,540, 564,542, 562,540, 564,540, 562,564, 538,540, 564,540, 564,540, 564,538, 564,540, 564,538, 564,540, 564,540, 562,542, 564,540, 564,540, 564,542, 562,538, 566,538, 564,540, 562,540, 564,538, 564,540, 564,538, 564,538, 566,538, 566,540, 562,542, 562,540, 1668,540, 566,540, 564,538, 566,540, 566,538, 564,538, 564,540, 564,538, 566,538, 566,538, 566,540, 564,540, 564,540, 566,538, 566,538, 564,538, 566,538, 568,538, 564,540, 564,538, 566,538, 566,538, 566,540, 566,538, 566,538, 564,538, 566,538, 566,540, 1670,538, 564,538, 1670,538, 1672,540, 1670,538, 566,538, 566,538, 566,538, 564,540, 566,538, 566,540, 564,538, 568,538, 566,538, 1670,540, 1672,538, 566,538, 566,538, 1670,538, 566,538, 566,538, 564,538, 568,536, 1672,536, 566,538, 1670,538, 566,536, 568,536, 1672,538, 568,536, 1672,536, 566,538, 566,538, 566,538, 1672,538, 566,536, 568,536, 568,536, 1672,536, 7420,536};// NEOCLIMA

//空调关
uint16_t power_off = {6142, 7412,542, 564,542, 564,540, 564,542, 562,540, 564,542, 564,540, 564,540, 564,540, 564,540, 564,540, 562,540, 566,538, 564,540, 564,540, 564,542, 564,540, 564,540, 564,540, 564,542, 562,540, 564,540, 564,540, 564,540, 564,540, 562,542, 564,564, 540,540, 566,540, 564,540, 1672,538, 566,538, 564,540, 564,540, 566,540, 562,542, 564,540, 564,540, 566,540, 564,540, 566,540, 564,540, 564,540, 564,540, 564,540, 564,540, 564,542, 564,540, 564,540, 564,540, 564,540, 564,540, 564,538, 564,540, 564,540, 562,540, 564,538, 564,540, 562,540, 564,540, 1670,540, 1668,540, 1670,538, 566,538, 564,538, 566,538, 564,540, 564,540, 564,540, 564,540, 566,538, 566,540, 1668,540, 1668,540, 564,538, 564,540, 1670,540, 566,538, 566,538, 564,540, 564,540, 1670,540, 564,538, 1670,540, 562,540, 566,540, 1670,540, 564,540, 1670,540, 566,540, 1670,538, 1670,540, 564,538, 566,538, 564,538, 566,538, 1672,538, 7414,540};// NEOCLIMA

//16摄氏度
uint16_t power_16 = {6174, 7390,564, 540,564, 540,564, 540,542, 564,540, 564,566, 542,564, 540,540, 566,564, 540,566, 540,540, 564,566, 538,566, 540,566, 538,566, 540,564, 540,564, 540,564, 540,564, 540,540, 564,564, 540,540, 566,540, 566,538, 564,540, 564,540, 564,540, 564,564, 540,540, 566,538, 1670,564, 540,540, 568,538, 566,538, 566,540, 566,538, 566,538, 564,540, 564,540, 564,540, 564,538, 1672,540, 1670,540, 568,538, 568,538, 566,540, 566,540, 566,538, 566,540, 564,538, 566,538, 566,538, 566,538, 568,536, 566,538, 568,538, 566,536, 568,536, 1672,538, 566,536, 1674,538, 1672,538, 1672,536, 570,536, 568,536, 568,536, 570,536, 566,538, 568,536, 570,536, 568,536, 570,536, 1672,536, 570,536, 568,538, 568,534, 568,536, 568,512, 1698,510, 596,510, 594,510, 1700,512, 594,510, 1700,510, 594,510, 594,510, 1700,510, 594,510, 1698,512, 594,508, 1700,510, 596,510, 594,508, 596,510, 1700,510, 592,510, 1702,508, 7450,510};// NEOCLIMA

//18摄氏度
uint16_t power_18 = {6148, 7416,540, 564,542, 564,542, 564,540, 562,542, 564,542, 562,542, 564,540, 564,540, 564,540, 566,540, 562,542, 562,542, 564,540, 562,542, 564,540, 566,540, 564,540, 564,564, 542,540, 564,540, 564,542, 564,542, 564,540, 564,540, 564,540, 566,540, 564,540, 564,540, 562,542, 1670,538, 564,540, 564,540, 562,540, 566,540, 564,540, 566,540, 564,540, 566,540, 564,542, 566,540, 1672,564, 1646,540, 564,540, 564,540, 564,540, 562,542, 562,542, 564,540, 564,540, 564,540, 566,538, 564,540, 566,540, 562,542, 564,540, 562,540, 564,540, 1670,540, 564,542, 1670,538, 1672,540, 1670,540, 564,540, 564,540, 564,542, 564,540, 566,540, 564,540, 564,542, 538,564, 566,540, 1670,540, 564,540, 1670,540, 564,540, 566,540, 566,540, 1670,542, 564,542, 562,540, 1672,540, 564,542, 1670,540, 564,540, 562,542, 1670,540, 566,540, 1668,540, 564,540, 566,540, 1670,540, 564,540, 562,540, 1668,540, 564,540, 1668,540, 7418,540};// NEOCLIMA

//20摄氏度
uint16_t power_20 = {6144, 7410,538, 564,540, 564,540, 562,540, 564,538, 564,540, 564,542, 562,540, 564,540, 564,540, 564,540, 562,540, 564,540, 564,540, 564,538, 564,538, 566,538, 564,540, 562,540, 562,540, 564,538, 564,540, 564,540, 564,540, 564,540, 564,540, 566,538, 564,538, 564,538, 564,540, 1668,540, 564,540, 566,538, 564,540, 562,540, 564,540, 564,538, 566,538, 564,540, 564,538, 564,540, 564,538, 1670,540, 564,538, 564,540, 564,540, 564,540, 564,540, 564,538, 564,540, 564,540, 564,538, 568,538, 564,540, 564,540, 564,538, 566,538, 564,538, 1670,538, 566,540, 1668,540, 1670,538, 1668,540, 564,538, 564,540, 564,540, 566,538, 564,538, 566,538, 564,540, 564,540, 564,540, 1670,538, 566,538, 566,540, 1668,540, 566,538, 566,538, 1670,538, 564,538, 566,538, 1670,538, 566,538, 1672,538, 566,538, 564,538, 1670,538, 566,538, 1670,538, 1670,538, 566,538, 1670,538, 564,540, 564,538, 1670,538, 566,540, 1670,538, 7416,538};// NEOCLIMA

//25摄氏度
uint16_t power_zhineng = {6142, 7410,538, 564,540, 564,540, 566,538, 564,540, 564,538, 564,540, 564,538, 566,540, 564,540, 566,538, 566,540, 566,538, 566,538, 566,540, 564,538, 566,538, 564,538, 566,538, 566,538, 564,540, 564,540, 564,540, 566,538, 566,538, 564,540, 568,536, 566,538, 566,540, 566,538, 1672,538, 566,538, 566,538, 568,538, 564,540, 564,540, 566,540, 564,540, 566,538, 566,538, 566,540, 564,538, 1672,540, 566,538, 566,538, 566,538, 566,540, 566,538, 566,538, 566,538, 564,540, 566,538, 566,538, 566,538, 566,538, 566,538, 566,538, 568,538, 1672,538, 566,538, 1674,536, 1672,538, 1672,538, 568,538, 568,538, 566,538, 568,538, 566,538, 564,540, 566,536, 568,538, 566,536, 1672,538, 1674,538, 566,538, 566,538, 1672,538, 566,536, 568,538, 566,538, 568,536, 1674,536, 568,536, 1674,536, 570,536, 568,536, 1674,536, 568,536, 1674,536, 566,512, 1698,536, 570,536, 1672,536, 568,534, 570,536, 568,534, 1674,536, 7422,536};// NEOCLIMA

//26摄氏度
uint16_t power_26 = {6168, 7360,590, 540,566, 538,564, 540,542, 562,564, 540,542, 564,564, 540,540, 564,540, 564,564, 540,564, 540,564, 540,564, 540,564, 540,564, 540,540, 564,540, 564,566, 538,564, 540,564, 540,564, 540,564, 542,564, 540,540, 564,564, 538,566, 540,564, 538,566, 538,540, 564,564, 1644,540, 564,540, 564,540, 562,566, 540,562, 540,566, 538,564, 538,540, 564,538, 564,540, 564,540, 564,542, 1668,540, 564,540, 564,540, 564,540, 566,562, 540,538, 564,540, 564,540, 566,538, 564,564, 540,540, 564,540, 564,540, 564,538, 564,540, 566,538, 1670,538, 564,538, 1670,540, 1666,540, 1672,538, 566,540, 564,540, 564,540, 566,540, 564,540, 566,538, 566,540, 566,538, 568,538, 1670,540, 564,540, 1672,538, 566,538, 1672,538, 564,540, 566,540, 566,538, 1674,538, 1672,538, 568,538, 1672,538, 566,538, 564,540, 1672,538, 566,538, 1670,538, 1672,538, 1670,538, 566,538, 1672,538, 566,538, 566,538, 566,538, 566,538, 7396,562};// NEOCLIMA

//28摄氏度
uint16_t power_28 = {6170, 7390,540, 566,540, 564,540, 566,538, 564,540, 564,540, 564,538, 566,540, 564,540, 564,542, 562,542, 564,540, 564,540, 564,538, 564,540, 566,538, 566,540, 564,540, 564,542, 564,540, 564,540, 566,538, 564,540, 566,540, 562,540, 564,542, 564,540, 566,538, 564,540, 564,540, 1670,538, 566,540, 564,540, 564,540, 564,540, 562,540, 564,540, 564,540, 564,540, 562,542, 564,542, 562,540, 1670,540, 564,540, 566,538, 566,538, 564,540, 562,542, 564,540, 564,540, 564,542, 564,540, 566,540, 564,540, 564,540, 564,538, 564,540, 566,538, 1668,540, 564,540, 1670,540, 1668,540, 1672,538, 564,542, 564,540, 566,538, 566,540, 564,542, 564,542, 564,540, 566,540, 564,540, 1670,540, 564,538, 566,540, 1670,540, 1670,540, 562,540, 564,542, 564,540, 1668,540, 1672,538, 566,540, 1670,540, 564,538, 566,540, 1644,566, 566,538, 1672,538, 1670,540, 564,538, 1672,538, 1670,540, 564,540, 568,536, 566,538, 566,538, 7420,536};// NEOCLIMA

//30摄氏度
uint16_t power_30 = {6174, 7388,566, 540,540, 564,564, 540,566, 540,564, 538,564, 540,564, 538,542, 564,564, 540,564, 542,538, 564,540, 564,540, 564,540, 564,564, 540,542, 562,566, 540,564, 540,564, 542,538, 566,564, 540,540, 566,540, 564,540, 564,540, 564,566, 540,540, 566,538, 564,566, 540,540, 1670,538, 568,538, 566,538, 566,540, 564,538, 566,538, 566,540, 566,538, 566,538, 566,540, 564,540, 564,540, 1670,540, 566,540, 566,540, 564,538, 566,538, 566,538, 564,540, 566,540, 564,538, 566,540, 566,540, 566,538, 566,538, 566,538, 568,538, 566,538, 1672,538, 568,536, 1674,536, 1672,538, 1672,538, 568,536, 568,536, 568,536, 566,538, 568,534, 568,536, 568,536, 568,536, 568,538, 1672,536, 566,510, 1700,536, 1672,538, 1674,534, 568,536, 570,534, 568,538, 1674,536, 1674,536, 568,512, 1698,510, 592,512, 594,512, 1698,510, 594,510, 1700,510, 1700,510, 1700,512, 1700,510, 1700,510, 594,510, 594,510, 594,510, 594,510, 7450,510};// NEOCLIMA

// 新建Blinker组件对象
BlinkerButton Button1("btn-pwron");
BlinkerButton Button2("btn-pwroff");
BlinkerButton Button3("btn-pwr16");
BlinkerButton Button4("btn-pwr18");
BlinkerButton Button5("btn-pwr20");
BlinkerButton Button6("btn-pwrzhineng");
BlinkerButton Button7("btn-pwr26");
BlinkerButton Button8("btn-pwr28");
BlinkerButton Button9("btn-pwr30");

void setup()
{
//初始化串口
Serial.begin(115200);
//注册回调函数/
Button1.attach(Button1_callback);
Button2.attach(Button2_callback);
Button3.attach(Button3_callback);
Button4.attach(Button4_callback);
Button5.attach(Button5_callback);
Button6.attach(Button6_callback);
Button7.attach(Button7_callback);
Button8.attach(Button8_callback);
Button9.attach(Button9_callback);

//配网步骤:WIFI接入
Blinker.begin(auth, ssid, pswd);

//红外初始化
irsend.begin();

}
void loop()
{
Blinker.run();
}

//回调函数
void Button1_callback(const String &state)
{

BLINKER_LOG("get button state: ", state);
//检测到普通按钮按下(btn-pwron)
if (state == BLINKER_CMD_BUTTON_TAP)
{
    //发送红外指令
    irsend.sendRaw(power_on, 197, 42);// Send a raw data capture at 38kHz.
    Button1.print("空调开");

}

}
//回调函数
void Button2_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwroff按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_off, 197, 42);// Send a raw data capture at 38kHz.
    Button2.print("空调关");
}

}

//回调函数
void Button3_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr16按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_16, 197, 42);// Send a raw data capture at 38kHz.
    Button3.print("16摄氏度");
}

}

//回调函数
void Button4_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr18按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_18, 197, 42);// Send a raw data capture at 38kHz.
    Button4.print("18摄氏度");
}

}

//回调函数
void Button5_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr20按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_20, 197, 42);// Send a raw data capture at 38kHz.
    Button5.print("20摄氏度");
}

}

//回调函数
void Button6_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr智能按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_zhineng, 197, 42);// Send a raw data capture at 38kHz.
    Button6.print("智能");
}

}

//回调函数
void Button7_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr26按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_26, 197, 42);// Send a raw data capture at 38kHz.
    Button7.print("26摄氏度");
}

}

//回调函数
void Button8_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr28按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_28, 197, 42);// Send a raw data capture at 38kHz.
    Button8.print("28摄氏度");
}

}

//回调函数
void Button9_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr30按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
    irsend.sendRaw(power_30, 197, 42);// Send a raw data capture at 38kHz.
    Button9.print("30摄氏度");
}

}

XlinliY.Zhang 发表于 2021-5-16 22:04

define在include前

f969439474 发表于 2021-5-17 13:45

XlinliY.Zhang 发表于 2021-5-16 22:04
define在include前

感谢,昨天尝试了好多种方法,最后歪打正着可以了,但一直没搞懂,谢谢你的解答
页: [1]
查看完整版本: 自动配网改完就验证不过了