|
本帖最后由 oscarangustin 于 2019-7-25 19:22 编辑
本小白刚刚入手wifiduino,在上传程序时出现了如图所示的现象,设备始终显示为离线,但在运行例程时成功连接,特向各位大佬求助
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "04acdfe8ca0f";
char ssid[] = "ChinaNet-E4CD";
char pswd[] = "zzmlxhdsbz";
BlinkerNumber SITTINGTIME("sitting");
int sensor=7;
float t=0;
static float t1;
float time_read=0;
void heartbeat()
{
SITTINGTIME.print(time_read);
}
void setup()
{
Serial.begin(115200);
pinMode(sensor,INPUT);
BLINKER_DEBUG.stream(Serial);
BLINKER_DEBUG.debugAll();
Blinker.begin(auth,ssid,pswd);
Blinker.attachHeartbeat(heartbeat);
}
void loop()
{
Blinker.run();
int distance=digitalRead(sensor);
if(distance==0)
{
t++;
t1=t;
BLINKER_LOG("time ", t, " s");
time_read = t;
}
else
{
t=t1;
BLINKER_LOG("time ", t, " s");
time_read = t;
}
Blinker.delay(1000);
}
|
|