Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: cd_edwards on February 18, 2026, 08:55:01 AM

Title: tower lights
Post by: cd_edwards on February 18, 2026, 08:55:01 AM
I've noticed a few people have LED's on there CNC to show what it happening on the CNC. there are Tower lights available but seem to be very simple.

I've created a LUA script which pairs with an arduino. 3 outputs from your BOB are needed so it's not for everyone if you don't have them.
I used an arduino mini pro for mine. Just about any arduino will work though. maybe not ATTINY's though. 3 inputs and one output. Arduino
bit bangs the addressable RGB LED strip. I used a 1 meter (39") long strip with 144 LED's in it. Still a couple of little niggles to investigate, but it's working.
script's and code are available on github at
https://github.com/cdedwards/Tower-Script/tree/main

This will eventually work on MachPro as well. (a little problem where it's giving me an error about an ='s sign)


Colten
Title: Re: tower lights
Post by: tbadger on March 10, 2026, 12:03:24 PM
I got this working on MachPro with the available code. I have pasted the towerscript.PLC script into the PLC Script file, under the Operator > Screen Editor, [Screen Name] PLC Script, as follows:

Code: [Select]
if m.CommonPLCScript ~= nil then
m.CommonPLCScript()
end

if towerscript == nil then
towerscript = require "towerscript" -- Load's towerscript.lua from a path. probably C:\Mach4\Modules
end
towerscript.PLCScript()
Title: Re: tower lights
Post by: cd_edwards on March 10, 2026, 12:31:09 PM
I'm attempting this using the "recommended" global Monitoring System. So far I get some of it working as advertised, but this is not quite ladder logic and is rather limited. I'll keep plugging away at it thoug.
Title: Re: tower lights
Post by: tbadger on March 10, 2026, 01:25:13 PM
I've seen a YouTube video done by Carl on the Global Monitoring System and its use for non-alarm type things. So far I've not got my head wrapped around it. Seems incongruent with how I see things. Hoping for more documentation and good examples of how to use it.
Title: Re: tower lights
Post by: Indigaa on May 12, 2026, 04:22:36 AM
What challenges did you face while implementing the LUA script for the Arduino and LED strip
Title: Re: tower lights
Post by: cd_edwards on May 12, 2026, 12:24:42 PM
none really. finding the event's was somewhat challenging, but overall it was fairly easy to implement. The GMS from MachPro is another matter though. that thing is painful and if your not careful, can lead to error's that are difficult to fix.