sys.taskInit(function()
local data = {0x12, 0x34, 0x56, 0xab, 0xef}
local count = 1
while 1 do
-- 拼接字符串
local index = 1
local ret = ""
for index = 1, #data do
ret = ret .. string.format("%02X", data[index])
end
uart.write(uartid, string.fromHex(ret), #ret)
print(ret)
sys.wait(1000)
end
end)
Lua十六进制数组转字符串,串口16进制输出
最新推荐文章于 2022-08-28 01:10:27 发布