top of page
Writer's pictureRAJ SHARMA

Arduino Frequency Generator5Khz , Adjustable Duty Cycle


Arduino Code



#include <TimerOne.h>

//UNO only

void setup()

{

pinMode(9,OUTPUT);

Timer1.initialize(200); //200us = 5khz

Timer1.pwm(9,20); // 2% DC

// You can use 2 to 1023

// 0 & 1 gives a constant LOW

// 1024 gives a constant HIGH

// 2 gives ~125ns HIGH pulses

// 1023 gives ~125ns low pulses

// 512 gives 50us

}


void loop()

{

}



11 views0 comments

Recent Posts

See All

Comments

Couldn’t Load Comments
It looks like there was a technical problem. Try reconnecting or refreshing the page.
bottom of page