Microcontroller › Arduino › arduino uno › Hi HarshaThere are two ways
September 29, 2016 at 5:52 am
#14174
GANEEV SINGH
Participant
Hi Harsha
There are two ways to achieve what you're looking for; first is by using two PWM pins, one with sine-wave output and another with GND for the first half cycle and for the second half just interchnage these pin's outputs i.e. now second pin outputs sine-wave and first becomes GND.
Second method: Try adding a DPDT relay and make connections like we do it for turning a DC motor in both directions (that cross connection, if you're getting). Now turn on the relay whenever you want to interchange the outputs.
Good luck