03.02.2021, 10:00
This should accept strings in X/r format where X is a number between 0 and 3:
Code:
char = port:read(1, 1)
if char then
if char == 'r' then
if #line == 2 and line:sub(2, 2) == '/' then
value = tonumber(line:sub(1, 1))
if value and value >= 0 and value <= 3 then
grp.write('1/1/1', value)
end
end
alert(line)
line = ''
else
line = line .. char
end
end