Hello everyone, I'm new to HS Script.
I have recently purchased a relay switch, it requires 9 Bytes Hex Command to control "ON" and "OFF"
Here is my script, however it does not trigger relay actions.
What would be the correct way to write this?
Thanks for all your help.
I have recently purchased a relay switch, it requires 9 Bytes Hex Command to control "ON" and "OFF"
Here is my script, however it does not trigger relay actions.
What would be the correct way to write this?
Thanks for all your help.
PHP Code:
Const ComPort = 1
Const ComConfig = "9600,N,8,1"
Const ComMode = 0
Const ComScript = ""
Const ComFunct = ""
Sub Main()
Dim sRetVal
' Open the com port
sRetVal = hs.OpenComPortEx(ComPort, ComConfig, ComMode, ComScript, ComFunct)
if sRetVal <> "" then
hs.CloseComPort ComPort
sRetVal = hs.OpenComPortEx(ComPort, ComConfig, ComMode, ComScript, ComFunct)
end if
' Send the requested Hex "Relay On" to the Relay
hs.SendToComPort ComPort,"00 5A 55 00 01 01 00 00 B1"
' Wait for the response
InData = hs.GetComPortData(ComPort)
msgbox InData
hs.CloseComPort(ComPort)
end sub
Comment