cyborg5 / IRLib2

Library for receiving, decoding, and sending infrared signals using Arduino
GNU General Public License v3.0
384 stars 138 forks source link

Send Volume Control to RC5 #83

Closed KingJimmy27 closed 4 years ago

KingJimmy27 commented 4 years ago

I have read through the information given in detail but struggle to see how to send Volume Control to RC5. I have lost a controller for my Arcam amplifier and the instruction are: Vol+ would be 16-16 decimal Vol- would be 16-17 decimal So on pressing a button I have the line: mySender.send(RC5, 0x1010); And another button: mySender.send(RC5, 0x1011); But this does not work. Where should I place the start and control bits? Help would be appreciated.

Jim

KingJimmy27 commented 4 years ago

OK I have sorted it out, what I should have done in the first place but I got lazy, so here for anybody else to save time. Just looking at Vol+ which is 16-16 decimal according to the amplifier manual, and in the order the bits are sent where RC5 is 13 bits long. The code consists of a start bit, a toggle bit, 5 bits of data for the address and 6 bits of data for the command. For Volume increase I set the 12 bits as follows: bit 13 first bit is a start bit=1 binary bit 12 is the toggle which I made =0 binary the 5 bit of address code, 11 to 7 is 10000 or decimal 16 denoting a pre-amp the six bits of command code, 6 to 0 are 010000 or decimal 16 for + volume so putting all the bits together we get: 1010000010000 which is 0x1410 The code is now:

include

IRsend mySender;

void setup() { pinMode(PIND4, INPUT); //volume increase button pinMode(PIND5, INPUT); //volume decrease button pinMode(LED_BUILTIN, OUTPUT); }

void loop() { if ( digitalRead (PIND4)==0) { mySender.send(RC5, 0x1410); digitalWrite(LED_BUILTIN, HIGH); delay(50); digitalWrite(LED_BUILTIN, LOW); }

if (digitalRead(PIND5) == 0)
{
    mySender.send(RC5, 0x1411);
    digitalWrite(LED_BUILTIN, HIGH);
    delay(50);
    digitalWrite(LED_BUILTIN, LOW);
}

}

Thanks for a great library and all the technical information that goes with it.

Jim