Thanks for that GuyCo,
Your code has given me many ideas to try and improve my project. I’m just learning C type languages and so far my project has been built up by finding snippets of code that are close to my needs then bludgeoning them to do what I need.
I’m trying to make a MQTT and one button controlled dimmer that uses PWM outputs to into a Meanwell LED dimmer like a LCM-25 or IDLV-45A. I have played with a Krida triac module, but decided to go for the Meanwell dimmer for the energy efficiency and ability to dim to zero (z-wave etc and standard ‘dimmable’ led drivers only dim to 30% at best). Also Australian regulations specify certain standards and voiding them will invalidate insurance policies etc and since this stuff is going into a new building the electrical inspection would fail with the Krida style equipment. Aiming to use a UNO with a hard wired Ethernet board.