we have a signal module attached to my experiment which generates 1khz pwm signal but for my experiment to run a small BLDC motor it will accept only 400Hz as pwm signal. we tried to generate 400HZ with same duty cycle as input 1 KHz PWm signal for BLDC Motor using arduino MEGA 2560 but the output pulse is not at 400 HZ. int pwm_output=10;
int k;
int x=0;
int y=0;
static double duty;
static double freq;
static double timeperiod;
static long ONTime = 0;
static long OFFTime = 0;
static long tempPulse;
void setup() {
// put your setup code here, to run once:
pinMode(9,INPUT);
pinMode(pwm_output,OUTPUT);
TCCR2B = (TCCR2B & 0b11111000) | 0x05;
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
we have a signal module attached to my experiment which generates 1khz pwm signal but for my experiment to run a small BLDC motor it will accept only 400Hz as pwm signal. we tried to generate 400HZ with same duty cycle as input 1 KHz PWm signal for BLDC Motor using arduino MEGA 2560 but the output pulse is not at 400 HZ. int pwm_output=10;
int k;
int x=0;
int y=0;
static double duty;
static double freq;
static double timeperiod;
static long ONTime = 0;
static long OFFTime = 0;
static long tempPulse;
void setup() {
// put your setup code here, to run once:
pinMode(9,INPUT);
pinMode(pwm_output,OUTPUT);
TCCR2B = (TCCR2B & 0b11111000) | 0x05;
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
@avjspraneeth, please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum