是这么改吧?
CGI-BIN目录下的ROBOTDIVER
#!/usr/bin/lua
io.output("/dev/ttyATH0")
action = {
["C0"] = function (x) io.write(string.char(0xff,0x00,x,0x00,0xff)) end,
["C01"] = function (x) io.write("w") end,
["C02"] = function (x) io.write("s") end,
["C03"] = function (x) io.write("a") end,
["C04"] = function (x) io.write("d") end,
["C5"] = function (x) io.write(string.char(0xff,0x01,0x05,x,0xff)) end,
["C6"] = function (x) io.write(string.char(0xff,0x01,0x06,x,0xff)) end,
["C7"] = function (x) io.write(string.char(0xff,0x01,0x07,x,0xff)) end,
["C8"] = function (x) io.write(string.char(0xff,0x01,0x08,x,0xff)) end,
}
action[string.sub(os.getenv("QUERY_STRING"),1,2)](string.sub(os.getenv("QUERY_STRING"),3,5))
|