Machsupport Forum
		Mach Discussion => Mach4 General Discussion => Topic started by: michael123 on July 23, 2018, 06:07:17 AM
		
			
			- 
				Hi, my program, on button
local inst = mc.mcGetInstance()
local Output16 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT16)
local Output5 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5)
local Output12 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT12)
mc.mcSignalSetState(Output16, 1)  --On 
mc.mcSignalSetState(Output5, 0)  --Off
mc.mcSignalSetState(Output12, 0)  --Off
 i want to add "if" output 24 csmio ip have 1 then, but i write it (down) and doesnt work, sb could help me? 
if (mc.OSIG_OUTPUT24()==1)then
local inst = mc.mcGetInstance()
local Output16 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT16)
local Output5 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5)
local Output12 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT12)
mc.mcSignalSetState(Output16, 1)  --On 
mc.mcSignalSetState(Output5, 0)  --Off
mc.mcSignalSetState(Output12, 0)  --Off
end
			 
			
			- 
				Hi,
if (mc.OSIG_OUTPUT24()==1)then
 is  wrong. You cannot read a signal directly like that. You have to get the signal handle then read the state of the memory location
indentifed by that handle.
hsig=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT24)
local output24state=mc.mcSignalGetState(hsig)
if output24state==1  then
........
........
Craig