|
回帖奖励 +1 金币
[mw_shl_code=arduino,true]void updateWeather(void)
{
String get_weather = Blinker.weather();
BLINKER_LOG("weather: ", get_weather);
DynamicJsonBuffer jsonBuffer;
JsonObject& weather = jsonBuffer.parseObject(get_weather);
if (!weather.success()) {
BLINKER_LOG(get_weather, " , not a Json buffer!");
}
else
{
strcpy(wdata.weather_txt, weather["cond_txt"]);
strcpy(wdata.wind_dir, weather["wind_dir"]);
wdata.weather_code = weather["cond_code"];
wdata.temp = weather["tmp"];
wdata.hum = weather["hum"];
wdata.wind_sc = weather["wind_sc"];
wdata.pcpn = weather["pcpn"];
}
}[/mw_shl_code]
|
|