I purchased the following IR transmitter: https://www.sparkfun.com/products/10732
I have it connected to GPIO18 on my Pi (rev B).
VCC -> Pi 5v
GND -> Pi GND
CTL -> Pi GPIO18
I found some source code which I am trying to adapt to my needs in Lazarus using the wiringPi library. Of course I am replacing the pots in the code with software inputs. I do not really know C but the code seems pretty straightforward and easy to duplicate with wiringPi.
http://www.kerrywong.com/2012/08/27/rev ... -protocol/
So far I have not gotten it to work. I do not have an oscilloscope but when I view the LED with a digital camera, I can see it is flashing so I think the hardware part is correct. Doing some research, I am thinking the problem is most likely the frequency. The transmitter should transmit at 38Khz. I have done a bunch of searching (not really familiar with hardware) and it is not clear how to get that frequency with wiringPi.
The Arduino code from the link above does this which seems to set the frequency:
Is there something analogous for the Pi or with wiringPi for setting the frequency?
Code: Select all
//setup PWM: f=38Khz PWM=0.5 byte v = 8000 / 38; TCCR2A = _BV(WGM20); TCCR2B = _BV(WGM22) | _BV(CS20); OCR2A = v; OCR2B = v / 2;