Changes for page 05 Lua Script
Last modified by Devin Chen on 2025/03/04 14:07
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 4 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -301,8 +301,10 @@ 301 301 302 302 The example shows how to parse value from HTTP response body, and display into HMI internal address. The test forecast official website is [[https:~~/~~/www.weatherapi.com/>>url:https://www.weatherapi.com/]] 303 303 304 - From the API document,thee day forecast response wouldbelikethe follows:304 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/luahttp.zip]] 305 305 306 +From the API explorer of weatherapi, the one day forecast response would be like the follows(Because the original data of JSON is very long, there we just show the part of it): 307 + 306 306 {{code language="JSON"}} 307 307 { 308 308 "location": { ... ... @@ -511,4 +511,23 @@ 511 511 } 512 512 {{/code}} 513 513 514 -[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/luahttp.zip]] 516 +The core code is from file API_WEATHER.lua, and function name is get7DayWeatherapiByCityname. 517 + 518 +(% style="text-align:center" %) 519 +[[image:WeatherHTTPAPI.png]] 520 + 521 +The HMI offline simulator result: 522 + 523 +(% style="text-align:center" %) 524 +[[image:WeatherHTTPtestdisplay.png]] 525 + 526 += 17 **CSV File Reading** = 527 + 528 +The example shows how to read the csv file into HMI, and then display as table. 529 + 530 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/csvRead.zip]] 531 + 532 +The core code is from file readcsv.lua, and file path is set as Sheet_2023_06_13_15_29_45.csv at the root path for USB. 533 + 534 +(% style="text-align:center" %) 535 +[[image:luacsvfilereadcontent.png]]
- 1688968905886-196.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +26.5 KB - Content
- WeatherHTTPAPI.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +55.9 KB - Content
- WeatherHTTPtestdisplay.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +36.2 KB - Content
- luacsvfilereadcontent.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +46.5 KB - Content