|
|

楼主 |
发表于 2026-8-26 10:50:45
|
显示全部楼层
local send_data_buffer1 = {}
local send_data_buffer2 = {}
function on_control_notify(screen,control,value)
if screen == 0 and control == 2 and value == 1 then
-- 1. 读取并处理数据
local input_text1 = get_value(0, 3) * 10
local input_text2 = get_value(0, 6) * 10
-- 2. 发送第1帧(ID = CAN_CMD_ID)
send_data_buffer1[0] = (input_text1 >> 8) & 0xFF
send_data_buffer1[1] = input_text1 & 0xFF
canbus_write(0, 0x0A, 2, 0, 0, send_data_buffer1)
delay_ms(10) -- 5毫秒
-- 3. 发送第2帧(ID = 0x10)
send_data_buffer2[0] = (input_text2 >> 8) & 0xFF
send_data_buffer2[1] = input_text2 & 0xFF
canbus_write(0, 0x10, 2, 0, 0, send_data_buffer2)
end
end
我这样写,第二帧不能发送数据,麻烦帮我看一下是怎么回事 |
|