本帖最后由 526598 于 2020-6-21 08:19 编辑
[mw_shl_code=arduino,true]
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";
void weatherData(const String & data)
{
BLINKER_LOG("weather: ", data);
}
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
uint32_t BlinkerTime = millis();
Blinker.vibrate();
Blinker.print("millis", BlinkerTime);
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
Blinker.weather();
Blinker.delay(60000);
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Blinker.attachWeather(weatherData);
}
void loop()
{
Blinker.run();
Blinker.weather();
delay(120000);
}[/mw_shl_code]用串口监视器看返回值
参考地址 https://diandeng.tech/doc/weather-and-air
|