这个更简单了
macro_command main()
bool Button[2]//按钮
bool light[2]//指示灯
GetData(Button[0], "Local HMI", LB, 0, 2)
bool off=0,on=1
if Button[0] then
SetData(on, "Local HMI", LB, 10, 1)//指示灯1灭
SetData(off, "Local HMI", LB, 11, 1)//指示灯2亮
SetData(off, "Local HMI", LB, 0, 1)
end if
if Button[1] then
SetData(off, "Local HMI", LB, 10, 1)//指示灯1灭
SetData(on, "Local HMI", LB, 11, 1)//指示灯2亮
SetData(off, "Local HMI", LB, 1, 1)
end if
end macro_command |