I'm porting a code from c in the Arduino platform (I'm using an Arduino Leonardo). I wanto to remote control a camera with an IR LED. The info about the remote control want to emulate here. The code, here.
The Burst frequency to drive the IR LED is 32700 Hz, and i'm trying to make Arduino runs at this frequency.
I've not an engeneering background so i don't really know what to do. I think i need some kind of delay to make Arduino run at that frequency, there is a note on the frequency in the second link i gave:
Before compilation, the microcontroller clock frequency must be
specified […]In case the IR light is visible and the camera not responding: […]
check the program timing. The _delay_us() routines in the code need a
proper setting of the F_CPU variable.
EDIT: i'm posting because i have tried the code in here but it seems to be some communication problem with the IR signal emitted: not every time the LED blink (i have tested with a cellphone cam and it blinks at specified times) the camera is shooting.
Best Answer
The code in your example is written for a 7.9MHz clocked CPU:
Whereas Arduino runs at 16MHz. Since all delays in the code
_delay_ms(HPERIOD);
are in milliseconds, you should be just fine by deleting that firstF_CPU
line from the source and recompiling it. Arduino automatically uses the correct frequency for for your board (16MHz).