Hello Guest it is June 16, 2019, 07:45:24 AM

Author Topic: Read external input  (Read 873 times)

0 Members and 1 Guest are viewing this topic.

Read external input
« on: August 05, 2017, 07:42:56 PM »


Hello everyone, I'm new working with Mach 4 and I have the following problem:

I made a M Code (M110) to read an external input and depending on its state show a text. The problem is that running the M110 from the MDI does not read the input and I do not know if I have to activate something or I have to do it another way.

Thanks for the help...

Test code:

function m110()

   local inst = mc.mcGetInstance()
   hReg = mc.mcIoGetHandle(inst, mc.ISIG_INPUT1)
   
   if hReg == 1 then
        wx.wxMessageBox("External input activated!")
    else
        wx.wxMessageBox("External input disabled!")
    end
end

if (mc.mcInEditor() == 1) then
 m110()
end