Add documentation and examples for new features.

This commit is contained in:
yabu76 2026-03-08 11:17:50 +09:00
parent 1b0ef08d95
commit 2316c0216a
7 changed files with 702 additions and 73 deletions

21
examples/lua/expects.lua Normal file
View file

@ -0,0 +1,21 @@
--
-- example of intaction with AT modem.
--
tio.write("AT\r")
local matches, all = tio.expect("OK", 1000)
if matches == nil then
tio.echo("no response 1\r\n")
os.exit(0)
end
msleep(200)
tio.read(1000, tio.C.NOWAIT)
tio.write("ATFANTASYCMD\r")
local idx, matches, all = tio.expects({"OK", "ERROR", "BUSY"}, 1000)
if idx == nil then
tio.echo("no response 2\r\n")
os.exit(0)
end
-- this display 2, ERROR
print(idx, matches[1])
os.exit(0)