The triac is to regulate a heating element. I learnt that a triac cannot respond to a square wave from the microcontroller. That's why I need a high frequency with the square wave, like a modulation. I was thinking of using an AND logic gate to multiply these two waves together. I was wondering if there is an easier way since to connect a microcontroller and a triac, we'll also need a transformer to isolate the two components.