Thanks all. I can 100% guarantee its not the code. the code has been working flawlessly on an earlier version of this board where i was using digital pins 3 and 4 to drive the relays, however i needed to use those pins for i2c comms so i decided to use a3-a5 as digital outputs instead.
Ah but mike. Not on the Leonardo or Yun. On those its pins 2 and 3 which are used for i2c.
Afraid I can't use a bigger board as I need the Yun stuff
I can't post the code as it contains proprietary algorithms.