05 Lua Script

Version 20.1 by Theodore Xu on 2022/09/21 14:58

1 64bits Address Basic Algorithm

The example shows how to do the Addition, Subtraction, Multiplication and Division for HMI internal address. 

Download link

2 MQTT Client

The example shows how to connect to the MQTT server.(Test on MaQiaTTo)

Download link

3 Timer

The example shows how to use the Lua Timer function.

Download link

4 Trigger

The example shows how to use the Lua Trigger function.

Download link

5 User Free Protocol

The example shows the simple write and read of User Free protocol

Download link

6 Arabic Keypad

The example shows how to use the Lua to achieve the Arabic keypad. Also available for other non-English language like Cyrillic.

Download link

7 FTP Client

The example shows how the to establish the FTP server at WIN10 OS and make the HMI as FTP client.

Download link

1. About how to set up the FTP server in Windows PC: Build an FTP Site on IIS , How to set up and manage an FTP server on Windows 10

2. Enter PC (FTP Server) IP address and port number (Default 21).

LuaFTPDemoIP&Port.png

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.

LuaFTPDemoUpload.png

4. Change drive letter of file save path according to drop-down list (There are three option available: Flash, UDisk and SDCard). 

LuaFTPDemoDropBox.png

5. Change the filename of the file that needs to be downloaded from PC(Server).

LuaFTPDemoDownload.png

6. Set the default configuration in file "Script_BG.lua"

LuaFTPDemoInitial.png

✎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 "//".

LuaFTPDemoFilelist.png

8 Telegram Notification

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.

Download link

9 LINE Notify

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.

Download link