ESP8266连不上热点
求问大佬们,为什么代码编译成功,上传了,但是ESP8266的灯一直亮,连接不上热点/*
*SHT30 通过I2C接口测量温湿度,ESP8266的D1与SHT30的SCL相连、D2与SDA相连
*/
#define BLINKER_WIFI
#define BLINKER_MIOT_SENSOR
#include <Blinker.h>
#include <SHT3x.h>
SHT3x Sensor;//默认传感器类型为SHT30
char auth[] = "e205e91cdfd7";//blinker账户生产的密码,小爱同学必须选用阿里云
//代码配网用下面这两段
char ssid[] = "Liusir"; //WiFi账号
char pswd[] = "123456ll"; //WiFi密码
//定义blinker软件内数据组件键名分别为:humi、temp
BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");
float humi_read, temp_read;
//小米小爱状态回调函数
void miotQuery(int32_t queryCode)
{
BLINKER_LOG("MIOT Query codes: ", queryCode);
int hVal = humi_read; //多次测试湿度须为整数型
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("MIOT Query All");
BlinkerMIOT.temp(temp_read);
BlinkerMIOT.humi(hVal);
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.temp(100);
BlinkerMIOT.humi(100);
BlinkerMIOT.print();
break;
}
}
void heartbeat()
{
TEMP.print(temp_read);
HUMI.print(humi_read);
}
void dataStorage()
{
Blinker.dataStorage("temp", temp_read);
Blinker.dataStorage("humi", humi_read);
}
void setup()
{
//调试程序
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
Sensor.Begin(); //初始化温湿度传感器
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd); //代码配网用这段
Blinker.attachHeartbeat(heartbeat);
Blinker.attachDataStorage(dataStorage);
//注册小爱同学状态回调函数
BlinkerMIOT.attachQuery(miotQuery);
}
void loop()
{
Blinker.run();
Sensor.UpdateData();//更新传感器数据
temp_read = Sensor.GetTemperature();//读取温度
humi_read = Sensor.GetRelHumidity();
//调试窗口输出
if (isnan(temp_read) || isnan(humi_read))
{
BLINKER_LOG("Failed to read from SHT sensor!");
}else
{
BLINKER_LOG("Humidity: ", humi_read, " %");
BLINKER_LOG("Temperature: ", temp_read, " °C");
}
Blinker.delay(1000);
} 解决了,更新了一下固件,就可以连接上了
页:
[1]