Blinker无法连接手机-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2012|回复: 1

[已解答] Blinker无法连接手机

[复制链接]
发表于 2019-9-16 15:17 | 显示全部楼层 |阅读模式
怀疑库冲突,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);
    // }
  }
}



发表于 2019-9-16 17:24 | 显示全部楼层
完全不知道你那是啥库,建议自己看调试信息判断
https://www.arduino.cn/thread-84332-1-1.html
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-12-1 01:17 , Processed in 0.123884 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表