8777 views|22 replies

180

Posts

0

Resources
The OP
 

STM32+ESP8266 obtains weather information and displays it on LCD [Copy link]

 
This post was last edited by liunianu7 on 2018-11-6 10:23 Hardware platform: stm32f429, esp8266 serial port wifi module. Weather data source: YaYa Weather[ http://www.yytianqi.com ]. (Other weather apps require mobile phone number registration, but this one doesn't, so I'll use this one) stm32f429 is connected to esp8266 through serial port 6, esp8266 is connected to the server API interface of YaYa Weatherapi.yytianqi.com, and data is obtained through GET request.
From the official website, we can see that there are 8 different types of request interfaces. Free users can use the first two. We use forecast7d to test it. For example,
GET http://api.yytianqi.com/forecast ... 1&key=xxxxxxxxxxxxx[key go to the official website to register and replace it], then find a network debugging assistant to test it. (Remember to press enter at the end of key and then click send)
Because it is a free user, you can only get 2 days of weather. From the information obtained, we can see that the data is in json format and there is no gbk encoding. To display it normally on LCD, we need to use cjson to extract the fields we need and convert them into gbk. First format the data received by the network debugging assistant.
{ "code": 1, "msg": "Sucess", "counts": 29, "data": { "cityId": "CH280601", "cityName": "深圳", "sj": "2018-11-05 19:00:00", "list": [{ "tq2": "Cloudy", "tq1": "Cloudy", "numtq1": "01", "numtq2": "01", "qw1": "27", "qw2": "22", "fl1": "Breeze", "fl2": "Breeze", "numfl1": 0, "numfl2": "0", "fx1": "Northeast Wind", "fx2": "No sustained wind direction", "numfx1": "1", "numfx2": "0", "date": "2018-11-05" }, { "tq2": "多云", "tq1": "多云", "numtq1": "01", "numtq2": "01", "qw1": "29", "qw2": "22", "fl1": "Level 3-4", "fl2": "Breeze", "numfl1": "1", "numfl2": "0", "fx1": "East Wind", "fx2": "No sustained wind direction", "numfx1": "2", "numfx2": "0", "date": "2018-11-06" }] } } The data is easy to understand after formatting. Take out the fields we want to display from here and we're done.
Test example: 【】STM32F429_获取天气().rar (1.19 MB, downloads: 537)


This post is from stm32/stm8

Latest reply

Thank you for sharing   Details Published on 2019-7-8 14:29
 

1368

Posts

6

Resources
2
 
Good, great
This post is from stm32/stm8
 
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
 

113

Posts

1

Resources
3
 
Thank you for sharing
This post is from stm32/stm8
 
 

29

Posts

0

Resources
4
 
Thanks for sharing
This post is from stm32/stm8
 
 
 

180

Posts

0

Resources
5
 
There are also some interfaces that you can play with, such as generating QR codes.
This post is from stm32/stm8
 
 
 

2

Posts

0

Resources
6
 
Thanks for sharing
This post is from stm32/stm8
 
 
 

189

Posts

0

Resources
7
 
Thank you for sharing and liking
This post is from stm32/stm8
 
Personal signature单片机软件/硬件交流群:127034610
 
 

104

Posts

0

Resources
8
 
Very good reference, something to play with again
This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
9
 
This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
10
 
Can I add you on QQ?
This post is from stm32/stm8
 
 
 

2

Posts

0

Resources
11
 
The OP really opened my eyes.
This post is from stm32/stm8

Comments

Let’s play…  Details Published on 2018-12-25 15:55
 
 
 

180

Posts

0

Resources
12
 
ljy_08 posted on 2018-12-24 20:49 The OP really opened my eyes
Let’s play…
This post is from stm32/stm8
 
 
 

180

Posts

0

Resources
13
 
This post is from stm32/stm8
 
 
 

137

Posts

0

Resources
14
 
This post is from stm32/stm8
 
 
 

102

Posts

0

Resources
15
 

Support the original work of the host

This post is from stm32/stm8
 
 
 

4005

Posts

0

Resources
16
 

This post is from stm32/stm8
 
 
 

1

Posts

0

Resources
17
 
Not bad, not bad, I'll download it and study it.
This post is from stm32/stm8
 
 
 

291

Posts

0

Resources
18
 

It seems very powerful. Is the weather data transmitted via the Internet? The function is very powerful. This chip

This post is from stm32/stm8

Comments

Yes, via serial WiFi.  Details Published on 2019-6-26 11:27
 
 
 

180

Posts

0

Resources
19
 
generalcircuits posted on 2019-6-25 11:10 It looks very powerful. Is the weather data transmitted via the Internet? The functions are very powerful, this chip

Yes, via serial WiFi.

This post is from stm32/stm8

Comments

Excellent, I haven't learned this part yet, I don't understand, it looks quite interesting  Details Published on 2019-6-26 12:24
 
 
 

291

Posts

0

Resources
20
 
Liunianu7 posted on 2019-6-26 11:27 Yes, through serial port WiFi.

Excellent, I haven't learned this part yet, I don't understand, it looks quite interesting

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list