23.04.2019, 07:00
If you only have a single USB converter you can use a function to find port name:
Code:
function findttyusb()
for _, dev in ipairs(io.ls('/dev')) do
if dev:find('ttyUSB') then
return '/dev/' .. dev
end
end
end
tty = findttyusb()
if tty then
require('serial')
port = serial.open(tty)
end