Wiki source code of 05 Lua Script
Version 18.1 by Theodore Xu on 2022/09/21 14:48
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = **1 64bits Address Basic Algorithm** = | ||
2 | |||
3 | The example shows how to do the Addition, Subtraction, Multiplication and Division for HMI internal address. | ||
4 | |||
5 | [[Download link>>https://drive.google.com/file/d/1ji5RbQJzUn_rQ2couX062fYt_6dqQNRb/view?usp=sharing]] | ||
6 | |||
7 | = **2 MQTT Client** = | ||
8 | |||
9 | The example shows how to connect to the MQTT server.(Test on MaQiaTTo) | ||
10 | |||
11 | [[Download link>>https://drive.google.com/file/d/1LWLaOlhWB3BRSTLy3_2RC6Yb0wK7slEB/view?usp=sharing]] | ||
12 | |||
13 | = **3 Timer** = | ||
14 | |||
15 | The example shows how to use the Lua Timer function. | ||
16 | |||
17 | [[Download link>>https://drive.google.com/file/d/1iwD2Kca9SIAGCYFBaQbn26zdc4kIUuSV/view?usp=sharing]] | ||
18 | |||
19 | = **4 Trigger** = | ||
20 | |||
21 | The example shows how to use the Lua Trigger function. | ||
22 | |||
23 | [[Download link>>https://drive.google.com/file/d/1GDCbbMgNSixonXP2erA0VoJbo7qagsCv/view?usp=sharing]] | ||
24 | |||
25 | = **5 User Free Protocol** = | ||
26 | |||
27 | The example shows the simple write and read of User Free protocol | ||
28 | |||
29 | [[Download link>>https://drive.google.com/file/d/1v8UZvdclq3OGEajkbd78w7_XY2bY2qAe/view?usp=sharing]] | ||
30 | |||
31 | = **6 Arabic Keypad** = | ||
32 | |||
33 | The example shows how to use the Lua to achieve the Arabic keypad. Also available for other non-English language like Cyrillic. | ||
34 | |||
35 | [[Download link>>https://drive.google.com/file/d/1JqpTRRqj6db32aLn7tqqO8dWT6EuXBEL/view?usp=sharing]] | ||
36 | |||
37 | = **7 FTP Client** = | ||
38 | |||
39 | The example shows how the to establish the FTP server at WIN10 OS and make the HMI as FTP client. | ||
40 | |||
41 | [[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/FTP%20Client.zip]] | ||
42 | |||
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 | |||
45 | 2. Enter PC (FTP Server) IP address and port number (Default 21). | ||
46 | |||
47 | (% style="text-align:center" %) | ||
48 | [[image:LuaFTPDemoIP&Port.png]] | ||
49 | |||
50 | 3. Change the filename of the file that needs to be uploaded. If run on as Offline Simulator, the simulate upload path of "udisk:1.png" will be "C:\WECON\USB\1.png" on the PC. | ||
51 | |||
52 | (% style="text-align:center" %) | ||
53 | [[image:LuaFTPDemoUpload.png]] | ||
54 | |||
55 | 4. Change drive letter of file save path according to drop-down list (There are three option available: Flash, UDisk and SDCard). | ||
56 | |||
57 | (% style="text-align:center" %) | ||
58 | [[image:LuaFTPDemoDropBox.png]] | ||
59 | |||
60 | 5. Change the filename of the file that needs to be downloaded from PC(Server). | ||
61 | |||
62 | (% style="text-align:center" %) | ||
63 | [[image:LuaFTPDemoDownload.png]] | ||
64 | |||
65 | 6. Set the default configuration in file "Script_BG.lua" | ||
66 | |||
67 | (% style="text-align:center" %) | ||
68 | [[image:LuaFTPDemoInitial.png]] | ||
69 | |||
70 | ✎Note: If want to confirm whether it is downloaded successfully, please add a File list object to check in HMI project. If saved path is root path (same to the all three drive), please set the folder as "~/~/". | ||
71 | |||
72 | (% style="text-align:center" %) | ||
73 | [[image:LuaFTPDemoFilelist.png]] | ||
74 | |||
75 | = **8 Telegram Notification** = | ||
76 | |||
77 | 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. | ||
78 | |||
79 | [[Download link>>https://drive.google.com/file/d/1wV0O79TJ2mgUEBkKcjrb53PM8DkTQxVo/view?usp=sharing]] | ||
80 | |||
81 | |||
82 | = 9** LINE Notify** = | ||
83 | |||
84 | 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. | ||
85 | |||
86 | [[https:~~/~~/ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/line.zip>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/line.zip]] |