viewtopic.php?style=17&t=120880
Hello, I'm trying to use the Com communication from the above post. I built a code that should connect, according to the defined parameters, and successively send "i", "0", Enter key, "1" and Enter key again. The script runs without error, but when I connect via the classic terminal on the device there is no change, there will be a problem somewhere. I suppose it should work except for sending the Enter key. If I use the test code for the library the communication works correctly. Thank you.
Code: Select all
#Requires AutoHotkey v2.0
#Include "AutoHotkey v2 COM Library.ahk"
Port := "COM1"
Baud := "115200"
Parity := "N"
Bits := "8"
ComHandle := ComOpen(Port, Baud, Parity, Bits, 1) ; 1 stop bit
ComWriteString(ComHandle, "i")
Sleep 1000
ComWriteString(ComHandle, "0")
Sleep 1000
ComWriteByte(ComHandle, Ord(Chr(13)))
Sleep 1000
ComWriteString(ComHandle, "1")
Sleep 1000
ComWriteByte(ComHandle, Ord(Chr(13)))
MsgBox("Done")