当我新建9个组件的时候还能连上wifi的,但当我新建10个组件的时候wifi就连接不上去了,求帮忙
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <Blinker.h>
char auth[] = "588d2400f2fa";//这里面填写设备的密钥
char ssid[] = "rayjjd";//这里填写你的wifi名字
char pswd[] = "Rayjjd666@#*";//这里填写你的WiFi密码
//定义红外发射的管脚
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[197] = {6170, 7386, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 562, 540, 538, 564, 540, 564, 540, 566, 564, 542, 564, 542, 562, 540, 562, 540, 540, 564, 564, 540, 564, 540, 542, 566, 564, 538, 540, 564, 538, 566, 540, 566, 540, 564, 564, 542, 538, 566, 562, 542, 538, 564, 540, 566, 562, 540, 540, 564, 564, 1646, 562, 542, 538, 566, 540, 566, 538, 564, 540, 566, 538, 566, 540, 564, 540, 566, 538, 566, 540, 564, 538, 566, 538, 566, 540, 564, 540, 564, 540, 564, 540, 566, 538, 566, 540, 566, 538, 566, 538, 564, 540, 564, 538, 566, 538, 566, 540, 566, 538, 566, 538, 566, 538, 566, 538, 1670, 540, 1668, 540, 564, 538, 566, 538, 566, 540, 564, 538, 566, 538, 566, 538, 564, 538, 566, 538, 566, 538, 566, 540, 564, 538, 566, 538, 1670, 538, 1672, 538, 568, 538, 566, 538, 1670, 538, 566, 538, 564, 540, 566, 538, 564, 538, 1674, 536, 566, 538, 1672, 538, 566, 538, 566, 538, 1672, 538, 568, 536, 1672, 536, 566, 538, 568, 536, 1672, 540, 566, 538, 1674, 536, 568, 536, 1672, 536, 568, 538, 7420, 536}; // NEOCLIMA
//空调关
uint16_t power_off[197] = {6146, 7414, 540, 566, 540, 564, 540, 566, 538, 500, 602, 564, 564, 540, 540, 566, 538, 564, 538, 566, 538, 566, 538, 564, 540, 566, 562, 540, 540, 566, 538, 564, 540, 564, 540, 564, 540, 564, 540, 562, 542, 564, 540, 566, 564, 540, 562, 542, 540, 566, 540, 564, 540, 562, 540, 564, 542, 564, 540, 564, 540, 1670, 540, 566, 538, 566, 538, 566, 538, 566, 538, 564, 540, 564, 542, 564, 540, 564, 540, 566, 540, 564, 540, 564, 540, 566, 540, 564, 542, 564, 540, 564, 542, 564, 540, 566, 538, 564, 540, 566, 538, 566, 540, 566, 538, 566, 540, 566, 540, 562, 540, 566, 538, 566, 540, 566, 538, 564, 540, 1670, 540, 566, 538, 566, 540, 566, 538, 566, 538, 566, 540, 564, 540, 566, 538, 566, 540, 566, 538, 566, 540, 566, 540, 566, 538, 1670, 540, 1670, 540, 566, 538, 564, 540, 1670, 538, 564, 540, 564, 540, 564, 540, 566, 540, 1670, 538, 564, 540, 1670, 540, 564, 538, 568, 538, 1670, 538, 566, 538, 1670, 540, 566, 538, 1670, 540, 566, 538, 566, 538, 1672, 538, 568, 538, 1670, 538, 566, 538, 7420, 538}; // NEOCLIMA
//16摄氏度
uint16_t power_16[197] = {6144, 7412, 562, 540, 540, 564, 538, 566, 540, 564, 540, 566, 562, 542, 538, 564, 564, 542, 564, 540, 564, 540, 540, 564, 540, 564, 564, 540, 564, 542, 538, 564, 564, 540, 564, 540, 566, 540, 564, 540, 564, 542, 538, 566, 564, 540, 564, 542, 562, 540, 564, 542, 562, 542, 538, 564, 562, 542, 564, 540, 564, 1646, 538, 566, 562, 542, 538, 566, 538, 564, 562, 542, 562, 540, 562, 542, 538, 566, 538, 566, 536, 568, 538, 1670, 538, 1672, 538, 566, 538, 566, 540, 564, 540, 564, 540, 566, 536, 566, 538, 566, 538, 566, 538, 566, 536, 566, 538, 566, 538, 566, 538, 566, 536, 568, 538, 564, 538, 1672, 538, 568, 536, 1672, 538, 1672, 536, 566, 538, 566, 538, 566, 536, 568, 536, 568, 536, 568, 536, 568, 536, 568, 536, 568, 536, 568, 536, 1674, 536, 566, 538, 568, 536, 568, 536, 568, 536, 568, 536, 568, 536, 566, 538, 1674, 536, 1674, 538, 568, 536, 1674, 536, 568, 536, 568, 538, 1672, 536, 568, 536, 1674, 534, 568, 536, 1674, 534, 568, 512, 594, 534, 570, 512, 1698, 534, 1674, 510, 1700, 508, 7442, 510}; // NEOCLIMA
//18摄氏度
uint16_t power_18[197] = {6142, 7414, 538, 568, 538, 566, 562, 542, 540, 566, 562, 542, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 562, 542, 540, 562, 540, 564, 540, 564, 540, 564, 538, 564, 540, 564, 540, 564, 540, 564, 564, 540, 540, 564, 538, 568, 538, 564, 540, 566, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 1670, 538, 564, 540, 566, 540, 566, 538, 566, 538, 564, 540, 566, 562, 540, 540, 564, 540, 564, 538, 564, 538, 566, 538, 1672, 538, 564, 540, 566, 540, 564, 538, 566, 538, 566, 538, 564, 540, 566, 538, 564, 538, 566, 538, 566, 538, 566, 538, 566, 538, 564, 540, 566, 538, 566, 538, 1672, 538, 566, 538, 1672, 540, 1670, 540, 566, 538, 566, 538, 566, 538, 566, 538, 568, 538, 566, 538, 566, 538, 566, 538, 566, 538, 564, 538, 1674, 538, 566, 538, 1672, 538, 568, 538, 566, 538, 566, 540, 1672, 538, 566, 538, 566, 538, 1672, 538, 568, 536, 1674, 538, 568, 538, 566, 538, 1672, 540, 566, 536, 1672, 536, 1674, 536, 1672, 538, 568, 538, 566, 538, 566, 538, 566, 538, 566, 536, 1674, 538, 7418, 538}; // NEOCLIMA
//20摄氏度
uint16_t power_20[197] = {6124, 7442, 514, 558, 548, 586, 516, 590, 514, 562, 544, 556, 548, 556, 548, 586, 516, 588, 518, 586, 518, 588, 514, 588, 518, 586, 516, 558, 548, 556, 546, 556, 550, 558, 544, 590, 516, 528, 578, 586, 518, 590, 514, 588, 518, 556, 550, 586, 516, 588, 514, 588, 518, 586, 516, 588, 518, 586, 516, 528, 576, 1690, 516, 588, 516, 588, 516, 588, 516, 556, 548, 586, 514, 588, 516, 586, 518, 588, 516, 586, 516, 588, 518, 586, 516, 1692, 514, 588, 518, 588, 516, 588, 516, 588, 516, 586, 516, 588, 514, 586, 516, 586, 518, 586, 516, 588, 516, 588, 518, 588, 516, 588, 516, 590, 516, 586, 516, 1664, 548, 588, 514, 1694, 514, 1696, 514, 590, 514, 590, 514, 590, 514, 592, 510, 592, 512, 592, 512, 592, 486, 618, 486, 618, 486, 618, 484, 1726, 484, 620, 486, 620, 484, 1726, 484, 622, 484, 620, 486, 1726, 508, 596, 484, 620, 510, 1702, 508, 596, 508, 1700, 508, 594, 510, 596, 508, 1700, 510, 594, 510, 1698, 510, 1700, 534, 568, 510, 1698, 510, 596, 510, 594, 510, 594, 534, 570, 510, 1698, 534, 7420, 536}; // NEOCLIMA
//22摄氏度
uint16_t power_22[197] = {6172, 7384, 570, 536, 568, 534, 570, 534, 570, 534, 568, 536, 568, 536, 568, 506, 598, 532, 570, 506, 598, 534, 568, 536, 570, 534, 570, 538, 568, 534, 568, 562, 542, 534, 572, 534, 568, 536, 568, 562, 540, 538, 566, 536, 568, 534, 570, 508, 596, 534, 570, 536, 568, 534, 570, 534, 568, 538, 568, 534, 568, 1640, 572, 532, 572, 532, 570, 532, 572, 532, 572, 532, 570, 534, 570, 534, 572, 532, 572, 536, 568, 532, 574, 532, 572, 1638, 570, 534, 570, 534, 568, 534, 572, 534, 568, 536, 568, 534, 570, 562, 542, 534, 570, 534, 570, 534, 570, 534, 570, 534, 568, 534, 572, 532, 572, 534, 568, 1638, 570, 562, 542, 1642, 570, 1642, 566, 532, 574, 534, 568, 534, 572, 532, 572, 532, 572, 534, 570, 534, 572, 532, 570, 534, 568, 534, 572, 1636, 572, 536, 570, 1634, 572, 1638, 570, 534, 570, 536, 568, 1640, 568, 536, 570, 562, 540, 1640, 572, 534, 568, 1640, 568, 562, 542, 506, 600, 1638, 570, 532, 570, 1640, 568, 1638, 570, 1670, 542, 1640, 570, 534, 572, 530, 574, 532, 572, 534, 570, 1666, 542, 7416, 542}; // NEOCLIMA
//24摄氏度
uint16_t power_24[197] = {6172, 7396, 542, 564, 542, 564, 542, 564, 540, 566, 540, 564, 542, 566, 538, 564, 540, 562, 542, 564, 540, 566, 540, 566, 540, 564, 542, 564, 540, 564, 542, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 566, 540, 564, 540, 566, 540, 564, 542, 564, 540, 564, 542, 562, 540, 564, 542, 1670, 540, 564, 540, 564, 540, 566, 538, 564, 540, 564, 540, 564, 540, 566, 540, 566, 540, 564, 542, 562, 540, 564, 544, 1668, 540, 564, 540, 564, 540, 564, 540, 566, 540, 564, 540, 564, 542, 562, 542, 564, 540, 564, 540, 566, 540, 564, 540, 564, 540, 564, 542, 566, 540, 564, 542, 1668, 544, 562, 540, 1672, 540, 1668, 542, 564, 540, 564, 540, 566, 540, 564, 542, 564, 540, 564, 542, 564, 540, 564, 540, 566, 540, 564, 538, 1672, 538, 564, 542, 566, 540, 564, 540, 1668, 542, 566, 540, 1670, 542, 564, 540, 564, 540, 1670, 540, 566, 540, 1644, 568, 564, 540, 564, 540, 1670, 540, 564, 540, 1668, 540, 1672, 538, 564, 540, 564, 542, 1670, 540, 564, 540, 564, 540, 564, 538, 1672, 540, 7418, 540}; // NEOCLIMA
//26摄氏度
uint16_t power_26[197] = {6174, 7360, 594, 532, 572, 534, 568, 536, 568, 534, 570, 536, 568, 536, 570, 534, 570, 534, 570, 534, 568, 508, 596, 534, 570, 506, 596, 534, 570, 534, 568, 538, 568, 536, 570, 534, 568, 564, 542, 534, 570, 534, 570, 534, 570, 534, 570, 562, 540, 534, 568, 534, 570, 506, 602, 530, 574, 532, 570, 534, 570, 1638, 570, 534, 570, 534, 572, 534, 568, 536, 568, 534, 572, 534, 570, 504, 600, 534, 568, 538, 566, 536, 570, 532, 572, 1638, 570, 534, 570, 534, 568, 536, 568, 538, 566, 536, 570, 536, 568, 536, 568, 534, 570, 532, 572, 534, 568, 534, 568, 506, 600, 532, 568, 562, 542, 534, 570, 1638, 570, 534, 572, 1638, 572, 1668, 542, 562, 540, 532, 572, 504, 600, 532, 570, 538, 566, 534, 570, 532, 572, 532, 570, 534, 570, 504, 602, 1638, 570, 532, 572, 1636, 572, 562, 540, 1640, 570, 532, 570, 1638, 570, 562, 542, 508, 598, 1638, 572, 532, 568, 1668, 542, 534, 570, 534, 570, 1642, 570, 532, 572, 1668, 542, 1642, 568, 1638, 570, 530, 574, 1636, 572, 532, 572, 534, 568, 534, 572, 1638, 572, 7382, 574}; // NEOCLIMA
//28摄氏度
uint16_t power_28[197] = {6144, 7414, 540, 564, 540, 562, 542, 562, 542, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 562, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 564, 540, 566, 538, 562, 542, 562, 540, 564, 540, 564, 540, 564, 540, 566, 538, 566, 540, 1670, 540, 566, 538, 564, 540, 564, 540, 566, 540, 566, 538, 564, 540, 566, 540, 564, 542, 564, 540, 564, 540, 566, 540, 1670, 540, 564, 542, 564, 540, 564, 538, 566, 538, 564, 540, 564, 540, 564, 540, 564, 540, 566, 540, 566, 538, 566, 540, 570, 536, 564, 542, 564, 538, 564, 540, 1672, 540, 566, 538, 1670, 540, 1670, 540, 566, 538, 564, 538, 568, 538, 564, 540, 566, 540, 564, 540, 566, 540, 564, 540, 564, 540, 564, 538, 1670, 540, 564, 538, 566, 538, 1668, 540, 1670, 540, 568, 538, 1672, 538, 566, 538, 564, 540, 1670, 540, 566, 540, 1670, 538, 566, 538, 564, 538, 1670, 540, 566, 538, 1672, 538, 1670, 540, 566, 538, 1672, 538, 1670, 540, 564, 540, 566, 538, 568, 538, 1644, 566, 7420, 538}; // NEOCLIMA
//30摄氏度
uint16_t power_30[197] = {6142, 7410, 540, 562, 540, 564, 540, 562, 542, 562, 542, 562, 540, 562, 542, 562, 540, 564, 540, 562, 540, 564, 540, 562, 542, 562, 542, 560, 542, 564, 540, 564, 540, 564, 540, 564, 542, 564, 538, 564, 542, 564, 538, 564, 538, 564, 540, 564, 540, 564, 540, 562, 540, 562, 542, 562, 542, 564, 538, 562, 540, 1668, 540, 562, 542, 564, 540, 564, 542, 560, 542, 564, 538, 562, 542, 564, 540, 564, 540, 564, 540, 562, 540, 566, 538, 1670, 540, 566, 538, 564, 538, 562, 540, 564, 540, 564, 540, 564, 540, 562, 540, 564, 540, 566, 538, 562, 542, 564, 540, 564, 538, 564, 540, 564, 540, 564, 540, 1670, 540, 564, 540, 1670, 540, 1670, 540, 564, 540, 566, 538, 566, 540, 564, 540, 564, 540, 566, 538, 566, 538, 564, 542, 562, 540, 562, 540, 1672, 540, 564, 538, 1670, 540, 1668, 540, 1670, 540, 566, 540, 1670, 542, 564, 540, 562, 540, 1670, 540, 566, 540, 1670, 540, 564, 540, 564, 538, 1670, 540, 566, 540, 1668, 540, 1670, 540, 1670, 540, 1670, 540, 1670, 540, 564, 540, 564, 540, 564, 540, 1670, 540, 7416, 540}; // 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-pwr22");
BlinkerButton Button7("btn-pwr24");
BlinkerButton Button8("btn-pwr26");
BlinkerButton Button9("btn-pwr28");
BlinkerButton Button10("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);
Button10.attach(Button10_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-pwr22按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
irsend.sendRaw(power_22, 197, 42); // Send a raw data capture at 38kHz.
Button6.print("22摄氏度");
}
}
//回调函数
void Button7_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
//检测到btn-pwr24按钮按下
if (state == BLINKER_CMD_BUTTON_TAP)
{
irsend.sendRaw(power_24, 197, 42); // Send a raw data capture at 38kHz.
Button7.print("24摄氏度");
}
}
//回调函数
void Button8_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.
Button8.print("26摄氏度");
}
}
//回调函数
void Button9_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.
Button9.print("28摄氏度");
}
}
//回调函数
void Button10_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.
Button10.print("30摄氏度");
}
}
|