i want to create 100hz and pw 1ms in arduino

i am new to arduino please help! i want to create 100hz and pw 1ms in arduino

program to give 100hz and 1ms clock input to fire my IR LED

i used function generator and 555 timer circuit, friends says using arduino simply you can create it so i need a program

define PIN 11

void setup(){ pinMode(PIN,OUTPUT); // not absolutely required int DUTY = 10; TCCR1B = TCCR1B & 0b11111000 |4; }

void loop() { static long counter = 0; if(millis()%10==0){ counter++; analogWrite(PIN, counter%255); } }

i used this code it gives 498hz

What code?

No idea what this means

i want to create 100hz and pw 1ms in arduino with accurate

Can you explain more what you mean?

program to give 100hz and 1ms clock input to my IR LED i used function generator and 555 timer circuit, friends says using arduino simply you can create it so i need a program

define PIN 11

void setup(){ pinMode(PIN,OUTPUT); // not absolutely required int DUTY = 10; TCCR1B = TCCR1B & 0b11111000 |4; }

void loop() { static long counter = 0; if(millis()%10==0){ counter++; analogWrite(PIN, counter%255); } }

i used this code it gives 498hz

First read the how to use this forum sticky thread and edit your last post to comply with the rules on posting code.

Next why are you changing the PWM duty cycle in the loop function? It does not seem to be what you asked for.

Do you want the timers to produce this directly? If so there should be nothing in the loop function at all you just kick it off in the setup and it goes off by itself.

Google about changing the PWM frequency.

void setuo(){
pinMode (2, OUTPUT);
}
void loop(){
digitalWrite (2,  HIGH);
delay(1);
digitalWrite (2, LOW);
delay(9);
}

CrossRoads: void setuo(){ pinMode (2, OUTPUT); } void loop(){ digitalWrite (2,  HIGH); delay(1); digitalWrite (2, LOW); delay(9); }

btw small correction i found it its setup please update it in your code

void setup(){ pinMode (2, OUTPUT); } void loop(){ digitalWrite (2, HIGH); delay(1); digitalWrite (2, LOW); delay(9); }

crossroads thank you very much sir program is working fine my problem solved

crossroads thank you very much program is working fine my problem solved

But not your manners.