|
这个程序是下载bilibili博主的,程序应该是没问题的
但是编译就是出错,求助各位大神!
Arduino:1.8.11 (Windows 7), 开发板:"WifInfo, ESP07 (1M/192K SPIFFS), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 40MHz, 1MB (FS:64KB OTA:~470KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
ir.Gree:8:11: error: redefinition of 'char auth []'
char auth[] = "***********";//这里面填写设备的密钥
^
duoji:7:6: error: 'char auth [13]' previously defined here
char auth[] = "4c061b6996e9";
^
ir.Gree:9:11: error: redefinition of 'char ssid []'
char ssid[] = "***********";//这里填写你的wifi名字
^
duoji:8:6: error: 'char ssid [5]' previously defined here
char ssid[] = "LOCO";
^
ir.Gree:10:11: error: redefinition of 'char pswd []'
char pswd[] = "***********";//这里填写你的WiFi密码
^
duoji:9:6: error: 'char pswd [11]' previously defined here
char pswd[] = "1688816888";
^
F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai_dengpao-master\duoji\ir.Gree.ino: In function 'void setup()':
ir.Gree:42:6: error: redefinition of 'void setup()'
void setup()
^
duoji:84:6: error: 'void setup()' previously defined here
void setup()
^
F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai_dengpao-master\duoji\ir.Gree.ino: In function 'void loop()':
ir.Gree:59:6: error: redefinition of 'void loop()'
void loop()
^
duoji:103:6: error: 'void loop()' previously defined here
void loop()
^
"Servo.h" 对应多个库
已使用: C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\Servo
未使用:D:\arduino\libraries\Servo
exit status 1
redefinition of 'char auth []'
在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
[pre]#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Kelvinator.h>
#include <Blinker.h>
char auth[] = "***********";//这里面填写设备的密钥
char ssid[] = "***********";//这里填写你的wifi名字
char pswd[] = "***********";//这里填写你的WiFi密码
//暂存温度、风速、模式数据
int nowtemp = 26;
int num_mode = 1;
int nowfan = 5;
// 新建组件对象
BlinkerNumber NUM1("fan");
BlinkerNumber NUM2("settemp");
BlinkerButton Kelvinator_power("btn-pwr");
BlinkerButton Kelvinator_setmode("btn-mode");
BlinkerButton Kelvinator_Light("btn-deng");
BlinkerButton Kelvinator_sxfan("btn-sx");
BlinkerSlider Slider1("ran-wen");
BlinkerSlider Slider2("ran-fan");
//ESP8266的D2脚针
const uint16_t kIrLed = 4;
IRKelvinatorAC ac(kIrLed);
void printState() {
Serial.println("Kelvinator A/C remote is in the following state:");
Serial.printf(" %s\n", ac.toString().c_str());
unsigned char* ir_code = ac.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < kKelvinatorStateLength; i++)
Serial.printf("%02X", ir_code);
Serial.println();
}
void setup()
{
Serial.begin(115200);
ac.begin();
Kelvinator_power.attach(Kelvinator_power_callback);
Kelvinator_setmode.attach(Kelvinator_setmode_callback);
Kelvinator_Light.attach(Kelvinator_Light_callback);
Kelvinator_sxfan.attach(Kelvinator_sxfan_callback);
Slider1.attach(slider1_callback);
Slider2.attach(slider2_callback);
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
Blinker.attachHeartbeat(heartbeat);
Blinker.begin(auth,ssid,pswd);
}
void loop()
{
Blinker.run();
}
//空调电源开关
void Kelvinator_power_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
if (state == BLINKER_CMD_ON)
{
ac.on();
ac.setFan(5);
ac.setMode(kKelvinatorCool);
ac.setTemp(26);
ac.setLight(true);
ac.send();
Kelvinator_power.icon("fal fa-power-off");
Kelvinator_power.color("#00FF00");
Kelvinator_power.text("开");
Kelvinator_power.print("on");
}
else if (state == BLINKER_CMD_OFF)
{
ac.off();
ac.setLight(true);
ac.send();
Kelvinator_power.icon("fal fa-power-off");
Kelvinator_power.color("#FF0000");
Kelvinator_power.text("关");
Kelvinator_power.print("off");
}
}
//空调灯光
void Kelvinator_Light_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
if (state == BLINKER_CMD_ON)
{
ac.setLight(true);
ac.send();
Kelvinator_Light.color("#00FF00");
Kelvinator_Light.text("灯光开");
Kelvinator_Light.print("on");
}
else if (state == BLINKER_CMD_OFF)
{
ac.setLight(false);
ac.send();
Kelvinator_Light.color("#999999");
Kelvinator_Light.text("灯光关");
Kelvinator_Light.print("off");
}
}
//上下扇风
void Kelvinator_sxfan_callback(const String &state)
{
BLINKER_LOG("get button state: ", state);
if (state == BLINKER_CMD_ON)
{
ac.setSwingVertical(true);
ac.send();
Kelvinator_sxfan.color("#00FF00");
Kelvinator_sxfan.text("上下风");
Kelvinator_sxfan.print("on");
}
else if (state == BLINKER_CMD_OFF)
{
ac.setSwingVertical(false);
ac.send();
Kelvinator_sxfan.color("#999999");
Kelvinator_sxfan.text("上下风");
Kelvinator_sxfan.print("off");
}
}
//心跳包
void heartbeat()
{
switch (num_mode)
{
case 1:
Kelvinator_setmode.icon("far fa-recycle");
Kelvinator_setmode.color("#7FFFD4");
Kelvinator_setmode.text("自动");
break;
case 2:
Kelvinator_setmode.icon("fas fa-snowflake");
Kelvinator_setmode.color("#1E90FF");
Kelvinator_setmode.text("制冷");
break;
case 3:
Kelvinator_setmode.icon("fas fa-tint");
Kelvinator_setmode.color("#7CFC00");
Kelvinator_setmode.text("除湿");
break;
case 4:
Kelvinator_setmode.icon("fab fa-first-order-alt");
Kelvinator_setmode.color("#E0FFFF");
Kelvinator_setmode.text("送风");
break;
case 5:
Kelvinator_setmode.icon("fas fa-sun");
Kelvinator_setmode.color("#FF0000");
Kelvinator_setmode.text("制热");
break;
}
Kelvinator_setmode.print();
NUM2.print(nowtemp);
}
//空调模式按钮
void Kelvinator_setmode_callback(const String &state)
{
if (state == BLINKER_CMD_BUTTON_TAP)
{
num_mode++;
if (num_mode >= 6)
{
num_mode = 1;
}
switch (num_mode)
{
case 1:
ac.setMode(kKelvinatorAuto);
Kelvinator_setmode.icon("fal fa-recycle");
Kelvinator_setmode.color("#008000");
Kelvinator_setmode.text("自动");
break;
case 2:
ac.setMode(kKelvinatorCool);
Kelvinator_setmode.icon("fal fa-snowflake");
Kelvinator_setmode.color("#1E90FF");
Kelvinator_setmode.text("制冷");
break;
case 3:
ac.setMode(kKelvinatorDry);
Kelvinator_setmode.icon("fal fa-tint-slash");
Kelvinator_setmode.color("#87CEFA");
Kelvinator_setmode.text("除湿");
break;
case 4:
ac.setMode(kKelvinatorFan);
Kelvinator_setmode.icon("fab fa-first-order-alt");
Kelvinator_setmode.color("#2E8B57");
Kelvinator_setmode.text("送风");
break;
case 5:
ac.setMode(kKelvinatorHeat);
Kelvinator_setmode.icon("fas fa-sun");
Kelvinator_setmode.color("#FF0000");
Kelvinator_setmode.text("制热");
break;
}
Kelvinator_setmode.print();
ac.send();
}
}
//空调风速
void slider2_callback(int32_t value)
{
BLINKER_LOG("get slider value: ", value);
nowfan=value;
NUM1.print(nowfan);
ac.setFan(nowfan);
ac.setXFan(true);
ac.send();
}
//空调温度
void slider1_callback(int32_t value)
{
BLINKER_LOG("get slider value: ", value);
nowtemp=value;
NUM2.print(nowtemp);
ac.setTemp(nowtemp);
ac.send();
}[/pre] |
|