Changes for page 05 Lua Script
Last modified by Jett on 2025/06/07 17:34
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Attachments (0 modified, 9 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. joe1 +XWiki.2454238480 - Content
-
... ... @@ -1,45 +1,53 @@ 1 -= **1 64bitsAddress BasicAlgorithm**=1 += **1 **Arithmetic operations = 2 2 3 3 The example shows how to do the Addition, Subtraction, Multiplication and Division for HMI internal address. 4 4 5 -[[Download link>>https:// drive.google.com/file/d/1ji5RbQJzUn_rQ2couX062fYt_6dqQNRb/view?usp=sharing]]5 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/Arithmetic%20operations%20by%20Lua%20V1.0.zip]] 6 6 7 7 = **2 MQTT Client** = 8 8 9 9 The example shows how to connect to the MQTT server.(Test on MaQiaTTo) 10 10 11 -[[Download link>>https:// drive.google.com/file/d/1LWLaOlhWB3BRSTLy3_2RC6Yb0wK7slEB/view?usp=sharing]]11 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/Lua%20MQTT%20Client.zip]] 12 12 13 13 = **3 Timer** = 14 14 15 15 The example shows how to use the Lua Timer function. 16 16 17 -[[Download link>>https:// drive.google.com/file/d/1iwD2Kca9SIAGCYFBaQbn26zdc4kIUuSV/view?usp=sharing]]17 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/LuaTimer.zip]] 18 18 19 19 = **4 Trigger** = 20 20 21 21 The example shows how to use the Lua Trigger function. 22 22 23 -[[Download link>>https:// drive.google.com/file/d/1GDCbbMgNSixonXP2erA0VoJbo7qagsCv/view?usp=sharing]]23 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/LuaTrigger.zip]] 24 24 25 25 = **5 User Free Protocol** = 26 26 27 27 The example shows the simple write and read of User Free protocol 28 28 29 -[[Download link>>https:// drive.google.com/file/d/1v8UZvdclq3OGEajkbd78w7_XY2bY2qAe/view?usp=sharing]]29 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/Lua%20User%20Free%20Protocol.zip]] 30 30 31 31 = **6 Arabic Keypad** = 32 32 33 33 The example shows how to use the Lua to achieve the Arabic keypad. Also available for other non-English language like Cyrillic. 34 34 35 -[[Download link>>https:// drive.google.com/file/d/1JqpTRRqj6db32aLn7tqqO8dWT6EuXBEL/view?usp=sharing]]35 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/ArabicKeyboard.zip]] 36 36 37 37 = **7 FTP Client** = 38 38 39 -The example shows how t he to establish the FTP server at WIN10 OS and maketheHMI as FTP client.39 +The example shows how to establish the FTP server at WIN10 OS and make V2.0 HMI as FTP client. 40 40 41 41 [[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/FTP%20ClientV2.zip]] 42 42 43 +(% class="box infomessage" %) 44 +((( 45 +Note: The above demo can work normal in OS V2.0. But if HMI OS is V3.0, please change "r+" to "r" in the script. 46 +))) 47 + 48 +(% style="text-align:center" %) 49 +[[image:dZyxVCtWDz.png]] 50 + 43 43 ~1. About how to set up the FTP server in Windows PC: **[[Build an FTP Site on IIS>>https://docs.microsoft.com/en-us/iis/publish/using-the-ftp-service/scenario-build-an-ftp-site-on-iis]] **,** [[How to set up and manage an FTP server on Windows 10>>https://www.windowscentral.com/how-set-and-manage-ftp-server-windows-10]]** 44 44 45 45 2. Enter PC (FTP Server) IP address and port number (Default 21). ... ... @@ -81,7 +81,7 @@ 81 81 82 82 Error 1: 550 Access is denied 83 83 84 -Open Windows Settings → Update & Security→ Windows Security→ Firewall & network protection→ Advanced setting→ Inbound Rules→ New Rules→ Next → choose "This program path"→ input ‘’C:\Windows\System32\svchost.exe‘’→ Click“NEXT”continuously92 +Open Windows Settings → Update & Security→ Windows Security→ Firewall & network protection→ Advanced setting→ Inbound Rules→ New Rules→ Next → choose "This program path"→ input "C:\Windows\System32\svchost.exe"→ Click "NEXT" continuously 85 85 86 86 (% style="text-align:center" %) 87 87 [[image:qCzqnKTUhp.png]] ... ... @@ -98,17 +98,25 @@ 98 98 (% style="text-align:center" %) 99 99 [[image:vmG8WGu5P2.png]] 100 100 101 - 102 102 110 +Error 2: No route to host 111 + 112 +The previous steps are the same as Error 1 → Port → specific local ports→ input port number "21"→ Click "NEXT" continuously 113 + 114 +(% style="text-align:center" %) 115 +[[image:fdsxie8WHc.png]] 116 + 117 +(% style="text-align:center" %) 118 +[[image:4ALQq7niTV.png]] 119 + 103 103 = **8 Telegram Notification** = 104 104 105 105 The example shows how to use Bot API to push the notification to channel or group of Telegram. Please change the Token and Chat id to users' own one. 106 106 107 -[[Download link>>https:// drive.google.com/file/d/1wV0O79TJ2mgUEBkKcjrb53PM8DkTQxVo/view?usp=sharing]]124 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/Telegram.zip]] 108 108 126 += 9** LINE Notify(Not available now)** = 109 109 110 -= 9** LINE Notify** = 111 - 112 112 This example shows how to use the LINE Notify to send message into LINE group. When monitoring bit "@B_HDX0.0" changes, it will trigger and send the message. Please replace with your own Token. 113 113 114 114 [[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/line.zip]] ... ... @@ -116,6 +116,11 @@ 116 116 117 117 = 10** How to parse value from subscribing MQTT topic** = 118 118 135 +(% class="box infomessage" %) 136 +((( 137 +**Only ig series can use this function.** 138 +))) 139 + 119 119 This example shows how to parse value from subscribing MQTT topic. Get the value and calculate the average value for group F1, F2, F3 and F4. The testing topic name is "testtopic/test/no1/123456". 120 120 121 121 [[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/MQTT%20JSON%20parse.zip]] ... ... @@ -277,6 +277,11 @@ 277 277 278 278 = **13 MQTT Multi-link** = 279 279 301 +(% class="box infomessage" %) 302 +((( 303 +**Only ig series can support this function.** 304 +))) 305 + 280 280 The example shows use mqtt realize multi-machine function: 281 281 282 282 [[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/MQTT%20Multi-link.zip]] ... ... @@ -626,3 +626,46 @@ 626 626 627 627 (% style="text-align:center" %) 628 628 [[image:tPN1mbz7ny.png]] 655 + 656 += 23 Lua SMS = 657 + 658 +The example shows how to use HMI built-in 4G module to send SMS via Lua script. This demo requires the HMI model name with (G) or (AG). 659 + 660 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/Lua%20SMS%20Library.zip]] 661 + 662 += 24 ATC module Calling = 663 + 664 +The example shows how to use HMI to customize communication with the ATC-3101 module via Lua script to make phone call. 665 + 666 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/lua%20ATC%20calling.rar]] 667 + 668 +(% class="box infomessage" %) 669 +((( 670 +Note:Due to differences in operators, it is recommended to test before use. 671 +))) 672 + 673 += 25 Lua SQLite = 674 + 675 +The example shows how to generate a user customized database and table via Lua script. 676 + 677 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/SQL%20demo.zip]] 678 + 679 +~1. Choose the designate storage path of db file, here we choose the U disk; 680 + 681 +(% style="text-align:center" %) 682 +[[image:lgvAY47My2.png]] 683 + 684 +2. Create the database a.db and create the table filer; 685 + 686 +(% style="text-align:center" %) 687 +[[image:SbfZ7qC2qr.png]] 688 + 689 +3. Write the data of HDW10, then click Add data to insert new record into the table filer; 690 + 691 +(% style="text-align:center" %) 692 +[[image:sMi8nKsDCy.png]] 693 + 694 +4. Export the file a.db to PC, and using the DB Browser to view the created data(Because it is not standard data record file, not able to be recognized correctly by DataLogTool); 695 + 696 +(% style="text-align:center" %) 697 +[[image:xT8f08pfY0.png]]
- 1747813978928-699.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +53.7 KB - Content
- 4ALQq7niTV.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.joe - Size
-
... ... @@ -1,0 +1,1 @@ 1 +20.7 KB - Content
- SbfZ7qC2qr.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +15.3 KB - Content
- dZyxVCtWDz.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.joe - Size
-
... ... @@ -1,0 +1,1 @@ 1 +53.7 KB - Content
- fdsxie8WHc.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.joe - Size
-
... ... @@ -1,0 +1,1 @@ 1 +22.4 KB - Content
- lgvAY47My2.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +18.0 KB - Content
- lgvAY47MyI.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +17.1 KB - Content
- sMi8nKsDCy.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +17.3 KB - Content
- xT8f08pfY0.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Hunter - Size
-
... ... @@ -1,0 +1,1 @@ 1 +38.3 KB - Content