top of page
  • Writer's pictureRAJ SHARMA

Arduino Frequency Generator5Khz , Adjustable Duty Cycle


Arduino Code


5khz 2% duty Cycle
.zip
Download ZIP • 368B

#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()

{

}



7 views0 comments

Recent Posts

See All

1 Minute and 10Minute Timer , Arduino Code

Ten Minute Code const int switch_on = 5, output = 9; int offtime = 1, off_timer_start = 0; void setup() { pinMode(switch_on, INPUT); pinMode(output, OUTPUT); } void loop() { int x = ((millis() / 10000

Comentários


bottom of page