diff options
-rw-r--r-- | onkyo_ri.pde | 17 |
1 files changed, 16 insertions, 1 deletions
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() { |