I am making an 5 level inverter using arduino so for that i have written simple arduino program for switching the mosfet but problem i am facing in this is it has low switching frequency so i want to write program using spwm technique now i dont know where to start can any one help me out.
I never guaranteed that me code would work!
However, looking at the schematic your posted, the pin-to-MOSFET assignments are not correct. For the code I provided, the assigments for your schematic IMHO should be
I have tried this by changing the pins but still i did not get the output.
Fair enough...
On my side, the output pattern is right, at least on paper!
Guess it's time for YOU to figure out the ACTUAL sequence the MOSFETs need to turn ON at each step in your circuit and mod values in the 'switching_sequence' array accordingly. The issue most likely lies there as the pattern is 'almost' there!
I hope you took the trouble to try and understand how the sample code I proposed works. If not, time for you to get on it!
I cannot test it, so the troubleshooting part is ALL up to you!