From 6a072ffc96fb16b44bf21e9b4e4ae9e2b64f78f6 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 18 Nov 2011 22:07:11 +0100 Subject: translate the onkyo signals into the ones for pioneer --- onkyo_ri.pde | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/onkyo_ri.pde b/onkyo_ri.pde index a23c920..4ce88c2 100644 --- a/onkyo_ri.pde +++ b/onkyo_ri.pde @@ -70,12 +70,27 @@ void send(ir_t *proto, uint64_t value, int pin, bool inverted) { void setup(void) { Serial.begin(9600); Serial.println("Ready to decode IR!"); - pinMode(13, OUTPUT); + pinMode(8, OUTPUT); + + digitalWrite(8, HIGH); +} + +void findKey(ir_map_t *ir_map, uint8_t count, uint64_t code) { + uint8_t i; + + for (i = 0; i < count; i++) { + if (ir_map[i].from == code) { + send(&pioneer, ir_map[i].to, 8, true); + return; + } + } } void loop(void) { uint64_t code = listenForIR(&onkyo); Serial.println(code, HEX); + + findKey(ir_map, ARRAY_LEN(ir_map), code); } int getPulseLength() { -- cgit v1.2.3