;用虛擬串口虛擬2個串口,tera term使用串口2
;設置串口2 波特率 115200,超時500ms;如果收到串口發來OK則回復SUCCESS;如果收到ERROR則回復faile
;若超時則發送timeouts.
connect " /c=2 /BAUD=115200"
timeout = 0
mtimeout = 500
while 1
wait 'OK' 'ERROR'
; If timeout occurs, 發送 ":timeout".
if result=0 then
sendln "timeouts"
; has received, 發送 ":error".
elseif result=1 then
sendln "success"
; "ERROR" has received, 發送 ":faile".
elseif result=2 then
sendln "faile"
endif
endwhile