LUA Inputs & Outputs

Inputs and Outputs

Lua scripting on MASSO includes a dedicated set of LUA Inputs and LUA Outputs, which are independent from the standard Auxiliary Inputs and Outputs of the controller.

 


Overview

MASSO provides 16 LUA Inputs and 16 LUA Outputs that can be fully controlled and monitored from within Lua scripts.
These act as virtual I/O channels used for custom automation logic, tool handling, machine monitoring, and process control — all without interfering with standard machine wiring or signals.

  • LUA Inputs (0–15):
    Used to read digital signals or logical conditions.

  • LUA Outputs (0–15):
    Used to activate, control, or signal other systems, internally or externally.

 


Key Features

  • Each LUA Output can be mapped to any physical output pin on the MASSO controller.

  • LUA I/O can be used for:

    • Custom automation or logic control

    • Safety interlocks and process validation

    • Tool or fixture management

    • External device signaling (e.g., lights, pneumatic valves)

  • Independent of G-code — Lua I/O can operate in the background or in response to triggers.

 

WARNING: Heavy or complex code inside background loops can reduce controller performance or cause timing issues. Always keep Lua logic short, efficient, and event-based when possible. 

 

 


Mapping LUA Outputs to Physical Outputs

LUA Outputs are virtual, meaning they do not directly control hardware until assigned.
You can map any of the 16 LUA Outputs to a physical output on the MASSO controller, allowing Lua logic to interact with real-world devices.

 

How to Map LUA Outputs:

  1. Open the F1-Setup screen, then go to the Output Settings page on the MASSO controller.

  2. In the list of outputs, choose the physical output you want to control.

  3. In the “Function” dropdown menu, select “LUA Output X”, where X is the Lua output number (0–15).

  4. Save and restart the controller.

After mapping, when your Lua script sets LUA Output X HIGH or LOW, it will directly control that physical output pin.

 

Example: If “Output 5” is mapped to “LUA Output 3”, then:

M.io.set_output(3, true)

will activate physical Output 5 on the controller.


 

 

Tool Changer Inputs and Outputs

When creating scripts for an Automatic Tool Changer (ATC), use the dedicated Tool Changer Inputs and Tool Changer Outputs, not the general LUA I/O.

These are reserved for tool changer control and allow safer, more predictable operation when performing automatic tool changes.

Example: Tool Changer I/O should be used for sensors such as Tool Clamp, Arm Home, or Magazine Ready.


 

Examples

 

Example 1: Setting a LUA Output

This example shows how to turn a LUA output ON and then later OFF.

-- Set LUA output 3 to HIGH
M.io.set_output(3, true)
-- Wait for a short period (for example, 2 seconds)
M.sleep(2000)
-- Set LUA output 3 to LOW
M.io.set_output(3, false)

 

Example 2: Reading a LUA Input

This example reads the state of a LUA input and prints its status to the console.

-- Read the state of LUA input 5
local input_state = M.io.get_input(5)
-- Check the input state and display the result
if input_state then
  print("LUA Input 5 is HIGH")
else
  print("LUA Input 5 is LOW")
end

 

Example 3: Conditional Control

This example shows how to turn an output ON only when a specific input is active.

-- Read LUA input 2
local input_state = M.io.get_input(2)
-- If input 2 is HIGH, turn on output 4
if input_state then
  M.io.set_output(4, true)
  print("Input 2 is active ? Output 4 turned ON")
-- Otherwise, turn it OFF
else
  M.io.set_output(4, false)
  print("Input 2 is inactive ? Output 4 turned OFF")
end