|
怀疑库冲突,2个库单独一个能用,加起来用不了了,有大佬帮忙看看吗?#define BLINKER_WIFI
#include <Blinker.h>
#include <TM1637.h>
char auth[] = "xxxxxxxxxxxx";
char ssid[] = "TVT";
char pswd[] = "88888888";
int i, a, b = 24, jia = 0, yi = 0, y, u = 1;
TM1637 tm1(5, 4); //12分钟倒计时
TM1637 tm2(0, 2); //24秒倒计时
TM1637 tm3(14, 12); //记分器
BlinkerButton Button1("btn-11");
BlinkerButton Button2("btn-12");
BlinkerButton Button3("btn-13");
BlinkerButton Button4("btn-14");
BlinkerButton Button5("btn-21");
BlinkerButton Button6("btn-22");
BlinkerButton Button7("btn-23");
BlinkerButton Button8("btn-24");
BlinkerButton Button9("btn-31");
BlinkerButton Button10("btn-32");
BlinkerButton Button11("btn-33");
void button1_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
jia = jia + 1;
Blinker.vibrate();
}
void button2_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
jia = jia + 2;
Blinker.vibrate();
}
void button3_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
jia = jia + 3;
Blinker.vibrate();
}
void button4_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
jia = jia - 1;
Blinker.vibrate();
}
void button5_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
yi = yi + 1;
Blinker.vibrate();
}
void button6_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
yi = yi + 2;
Blinker.vibrate();
}
void button7_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
yi = yi + 3;
Blinker.vibrate();
}
void button8_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
yi = yi - 1;
Blinker.vibrate();
}
void button9_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
if (state == "on") {
u = 1;
// 反馈开关状态
Button9.print("on");
} else if (state == "off") {
u = 0;
// 反馈开关状态
Button9.print("off");
}
}
void button10_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
y = jia;
jia = yi;
yi = y;
Blinker.vibrate();
}
void button11_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
b = 24;
Blinker.vibrate();
}
void setup()
{
tm1.init();
tm1.point(1);//小数点开关,1为打开,0为关闭
tm1.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
tm2.init();
tm2.point(1);//小数点开关,1为打开,0为关闭
tm2.set(BRIGHT_TYPICAL);
tm3.init();
tm3.point(1);//小数点开关,1为打开,0为关闭
tm3.set(BRIGHT_TYPICAL);
Blinker.begin(auth, ssid, pswd);
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);
Button11.attach(button11_callback);
}
void loop()
{
Blinker.run();
//if (u == 1) {
for (a = 11; a > 0; a--) {
tm1.display(0, a / 10); //第一位
tm1.display(1, a % 10); //第二位
for (i = 59; i > 0; i--) {
if (b > 0) {
b--;
}
tm1.display(2, i / 10); //第三位
tm1.display(3, i % 10); //第四位
tm2.display(2, b / 10); //第三位
tm2.display(3, b % 10); //第四位
delay(1000);
}
tm3.display(2, jia);
tm3.display(4, yi);
// }
}
}
|
|