In order for this to work, we need to load the HALUI module and run the HAL script shown below. If you’re using the AXIS GUI, the canonical way to do this is to create a file called “custom_postgui.hal” and put all of your personal HAL config commands in there.
Your .ini file should also include a line “HALUI = halui” in the [HAL] section. The Stepconf wizard will do all this for you if you select the option “Include Halui user interface module” on the Advanced Configuration Options page (do not select any other options unless you need them).
In your custom_postgui.hal, include the following lines. If you’ve named your python script something other than simple_arduino, make sure to change the line below accordingly.
#First we load the Python user module named /user/bin/simple_arduino with the name 'arduino' loadusr -Wn arduino simple_arduino #Map the machine on/off state to the arduino net machstate arduino.machine-state <= halui.machine.is-on #Map the switch events to the halui pins for requesting on and off net turnoff halui.machine.off <= arduino.switch-off net turnon halui.machine.on <= arduino.switch-on