It looks like a line of code got dropped from sendRC5code(). The "togglebit" part of the preamble isn't being sent. Shouldn't the code be:
void sendRC5code(int togglebit, unsigned int adres, unsigned int commando) {
int copyadres;
int copycommando;
RC5sendbit(1); //startbit 1
RC5sendbit(1); //extra commandbit, leave it 1
RC5sendbit(togglebit); // toggle bit finishes preamble
//5 data bits from the adres:
adres = adres & 0x1F; //1F = b00011111
etc...
An alternative approach, by the way, would be to use a PWM output set to 36KHz. You could then just set the duty cycle
to zero to turn off the IR signal, and set it to 50% (or, better yet, 33% per the spec) to turn the IR signal on.
It seems like that would have less overhead than attaching and detaching a ticker function. Just a thought.
Hi everybody
I am trying to send RC5 codes using my mBed. Bits are transmitted using a 36kHz carrier. To get this carrier, I used a ticker and set it to a time of 14uS. I attach or detach this carrier to send bits. I use the following code, but it doesn't work...
Does anyone have a clue what I'm doing wrong?
Thanks in advance!