Creating a carrier frequency

Hi

I wish to create a 37.47 khz carrier frequency (to drive an IR emitter). I've found this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1220294550/8#8 as reference but I'm not sure how to tweak it's timer setup...

Your probably trying to do the same thing I am here are the timer settings. If you use the native digital_write command it will disable the timers.

This is right out of my testing without clean up but it is triggering the IR reciver I am using.

void setup() {

// Don't use Timer0. Arduino uses that for timeing stull like dely() function // set up counter/timer 2 (8 bit) to act as a 38Khz generator // we want OC2A to toggle on matching OCR2A

TCCR2A = _BV(COM2A0) // toggle OC2A when match | _BV(WGM21); // mode 2 CTC

TCCR2B = _BV(CS20); // timer uses main system clock with NO prescale

OCR2A = 209; // fine tune for for 38kHz

/* // This is for testing is slows down the blinking to the point a human can see it // This assumes the above section is NOT commented out TCCR0B = _BV(WGM02) // along with "TCCR2B = _BV(CS20);" (above) sets the prescaler to 1024 | _BV(CS00) // | _BV(CS02); // timer uses main system clock with NO prescale OCR0A = 255; */

DDRB = _BV(PB3); // have to set up pins as outputs

}

void loop() { DDRB = _BV(PB3); // sets the LED on delay(100); // wait DDRB = ~(_BV(PB3)); // sets the LED off delay(100); // wait

}

I run the code but couldn't "see" any frequency generated except for BP3 turning on and off at a rate of about 5 Hz.

When I uncommented the "slows down the blinking to the point a human can see it" the rate was less than 1 Hz.

:-/

Change the loop section. I had alread gotten the modulation to work and I was on to the next test. The LED should be blinking at about 38khz so it will appear on. I used a IR receiver module to confirm this.

void loop() {
DDRB = _BV(PB3); // sets the LED on
}

I changed the loop and now the LED is just on.

what is meant by "This is for testing is slows down the blinking to the point a human can see it"? I uncommented this section and the LED kees on beeing on.

I thoungt that this should alter the modulation frequency so a human can see it.