Hi I'm making project using arduino to produce pwm from two output pin of my Arduino uno to the gate of two MOSFETs, so I'm stopped because of difficulty on the code this is my code to produce pwm 20KHZ.
#include <TimerOne.h>
const int P1 = 9;
const int P2 = 10;
void setup(void)
{
Timer1.initialize(50); // 50 us = 20 kHz
Serial.begin(9600);
}
void loop(void)
{
Timer1.pwm(P1, (341));
Timer1.pwm(P2, (682));
}
// 341, 682 is duty cycle Full = 1023
The problem i want to add code to this to make deadtime so that the two MOSFETs not work together at the same time either in off or on.
Please any one can make this happen.