|
手机触发按键,然后改变text的内容,使用过程中发现,一旦调用Blinker.print(),然后就卡死,操作什么都不行,串口也没任何数据传输,请求大佬指点。
手机端iPhone 7和Mi Note 都试过,情况都一样。
[mw_shl_code=c,true]/*
*/
/*
#define BLINKER_PRINTER Serial
#define BLINKER_DEBUG_ALL //不调试的时候选择注释掉
*/
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
//定义按钮
#define BUTTON_1 "ButtonKey"
#define BUTTON_2 "ButtonReset"
//定义三个情况的引脚
#define PinBig D9
#define PinMiddle D8
#define PinLittle D0
#include <Blinker.h>
char ssid[] = "InTron's PC";
char pswd[] = "chrome1111";
//定义三个下落的状态
int PinBigState = 0;
int PinMiddleState = 0;
int PinLittleState = 0;
void setup()
{
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(ssid, pswd);
Blinker.wInit(BUTTON_1, W_BUTTON);
Blinker.wInit(BUTTON_2, W_BUTTON);
}
void Scan(int PinBig,int PinMiddle,int PinLittle)
{
if(digitalRead(PinBig)== HIGH )
{
PinBigState++;
}
if(digitalRead(PinMiddle)== HIGH )
{
PinMiddleState++;
}
if(digitalRead(PinLittle)== HIGH )
{
PinLittleState++;
}
}
void Reset()
{
PinBigState = 0;
PinMiddleState = 0;
PinLittleState = 0;
}
void loop()
{
Blinker.run();
Scan(PinBig,PinMiddle,PinLittle);
if (Blinker.available()) {
BLINKER_LOG2("Blinker.readString(): ", Blinker.readString());
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print(BlinkerTime/1000);
Blinker.print("millis", BlinkerTime/1000);
}
if (Blinker.button(BUTTON_1))
{
//digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
Blinker.print("state", "btn1");
}
if (Blinker.button(BUTTON_2))
{
//Blinker.print("Reset");
Blinker.print("state", "Reset");
Reset();
}
}
[/mw_shl_code]
|
|