2020-07-01 18:04:37 -03:00
|
|
|
-- Lua script to write and read from a serial
|
|
|
|
|
2020-01-08 16:34:26 -04:00
|
|
|
local port = serial:find_serial(0)
|
|
|
|
|
|
|
|
port:begin(115200)
|
|
|
|
port:set_flow_control(0)
|
|
|
|
|
|
|
|
local step = 65
|
|
|
|
|
|
|
|
function spit ()
|
|
|
|
if port:available() > 0 then
|
|
|
|
read = port:read()
|
|
|
|
gcs:send_text(0, read .. " = " .. step)
|
|
|
|
end
|
|
|
|
if step > 122 then
|
|
|
|
step = 65
|
|
|
|
else
|
|
|
|
step = step + 1
|
|
|
|
end
|
|
|
|
port:write(step)
|
2020-07-01 18:04:37 -03:00
|
|
|
return spit, 1000
|
2020-01-08 16:34:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
return spit, 1000
|