Trying to get IR codes from Mitsubishi Heat Pump Remote Control [solved]

I’m working with my new Mitsubishi heat pump unit, trying to gather the IR codes for analysis using my Uno. I’ve read several older threads working with this, but am still not able to collect all the IR data because of issues with the amount of data being sent.

This thread was helpful (credit to iisfaq), but I believe the IR library has been updated and I was unable to get beyond 255 codes returned even when editing the variables.

I used the code from this thread (roughly) to get to 860 returned values (when I tried 875 there wasn’t enough memory to keep working, had some wild data kicked out). I had to modify some of the variables so that they weren’t quite so large - I was running out of memory. I’ll put the code below.
http://forum.arduino.cc/index.php?topic=151199.15 (credit to Cybernetician)

I’ve only had my arduino for a week, but wondering if anyone has any ideas (or has tackled this sort of issue). I’m going to dig into the code a little more tonight to see if I can get a better understanding of it and perhaps dump the results every pair, 4 pairs, etc. and not need a monster variable to hold it all. Then again, maybe it all has to be processed at once - I’m still doing a lot of reading and learning about how IR codes work.

Any help is appreciated. Remote control is type:SG14A

Code slightly modified from link above:

/*
  IR Capture
  Copyright 2012, all rights reserved.
  James M. Eli
  1/14/2012
 
  project parts:
    (1) arduino 16MHz
    (1) 38KHz IR receiver
    (1) breadboard
    (3) wires
 
  IR - Arduino
  SIG - D2
  GND - GND
  VCC - VCC
*/

//definitions
#define IN_PIN 2
#define MAX_CAPTURE 860  // Line number 1
 
//globals
uint16_t capture[MAX_CAPTURE];
uint16_t now, start;
volatile bool flag_complete;
uint16_t i;    // Line number 2 uint8_t to uint16_t Key point of RAWBUF. uint8_t maximum range 255
 
//interrupt fires on ir event (rise/fall)
void IRInterrupt(void) {
  now = micros();
  capture[i++] = now - start;
  start = now;
  if (i >= MAX_CAPTURE) {
    detachInterrupt(0);
    flag_complete = true;
  }
}
 
void setup(void) {
  flag_complete = false;
  start = 0;
  now = 0;
  i = 0;
  Serial.begin(9600);
  attachInterrupt(0, IRInterrupt, CHANGE);
  Serial.println("Ready to capture.");
}
 
void loop(void) {
  while (1) {
    if (flag_complete) {
      for (i=0; i < MAX_CAPTURE; i++) {        
        Serial.println(capture[i]);
        //Serial.print(",");
        flag_complete = false;
      }
    }
  }
}

Results:

20840
3316
1720
356
1324
356
1316
360
488
352
488
348
536
304
1328
352
488
352
488
352
1324
352
1328
352
488
348
1328
352
488
352
536
304
1328
348
1328
352
488
352
1324
356
1324
352
488
352
488
348
1328
352
488
352
488
352
1324
352
492
348
448
392
484
356
488
348
536
304
492
348
488
352
488
352
488
352
484
352
488
352
488
352
488
352
488
348
488
352
448
392
488
352
488
352
488
348
488
352
488
352
488
348
492
352
488
348
488
352
488
352
1372
304
492
348
488
352
1328
352
488
352
532
304
492
348
1324
356
488
348
488
352
488
352
488
352
488
352
484
352
488
352
492
348
488
352
1324
352
1328
352
488
348
492
352
488
348
492
348
1328
348
492
348
492
348
488
352
1328
352
488
348
492
348
1328
352
1328
352
1324
352
488
352
536
304
1324
352
488
352
488
348
492
352
488
348
488
352
488
352
488
348
492
348
492
348
488
352
488
352
488
348
492
348
488
352
488
352
448
392
484
352
492
352
484
352
488
352
488
352
488
348
492
348
492
348
488
352
488
352
488
348
492
348
488
352
1328
348
492
348
488
356
1324
352
488
352
488
348
492
348
492
348
488
352
488
352
488
348
488
352
488
352
488
352
488
352
488
352
484
352
488
352
488
352
488
352
1324
352
1328
352
488
348
492
348
1328
352
1328
352
484
352
1376
304
11400
3336
1716
352
1328
352
1324
356
488
348
492
348
488
352
1324
352
492
348
488
352
1324
356
1324
352
488
352
1324
356
488
348
488
352
1328
352
1324
352
488
352
1328
352
1324
352
488
352
488
352
1328
348
492
348
488
352
1328
352
488
352
488
348
488
352
488
352
488
352
488
352
484
352
488
352
488
352
488
352
488
348
488
352
488
352
488
352
488
352
484
352
488
352
488
352
488
352
488
348
492
352
484
352
488
352
488
352
488
348
492
348
1328
352
488
352
488
352
1324
352
488
352
488
348
448
396
1284
392
488
352
488
352
488
348
448
392
488
352
488
352
488
348
448
396
484
352
1328
352
1324
352
488
352
488
352
488
352
488
348
1328
352
488
352
488
352
488
348
1328
352
488
352
488
352
1372
304
1328
352
1324
356
488
348
488
352
1328
352
488
348
448
392
488
352
488
352
488
348
492
348
488
352
488
352
488
352
488
348
488
352
492
348
488
352
488
352
488
352
488
348
488
352
488
352
488
352
488
352
488
348
488
352
488
352
488
348
492
348
492
348
488
352
488
352
488
348
1328
352
488
352
488
352
1324
352
492
348
488
352
488
352
488
352
484
352
488
352
488
352
488
352
488
352
484
352
492
348
488
352
488
352
488
352
484
352
488
352
1328
348
1328
352
488
352
488
352
1324
352
1328
352
488
352
1324
352
10216
3320
1720
352
1324
356
1324
352
488
352
488
352
488
352
1324
352
536
304
488
352
1324
352
1328
352
488
352
1328
348
492
348
488
352
1328
352
1324
352
488
352
1324
356
1324
352
488
352
488
352
1324
352
492
348
488
352
1328
348
492
348
488
352
488
352
488
352
488
352
488
348
492
348
488
352
448
392
488
352
488
348
536
304
492
348
488
348
492
348
492
348
488
352
488
352
488
352
488
348
1328
352
488
352
488
352
488
348
488
352
488
352
1328
352
488
348
492
348
1328
352
488
352
488
348
492
348
1324
356
488
348
492
348
488
352
488
352
488
352
488
348
492
348
488
352
488
352
1328
352
1324
352
488
352
488
352
488
348
492
348
1328
352
484
352
492
348
492
348
1328
352
488
348
492
348
1328
352
1328
352
1284
392
488
352
488
352
1324
352
488
352
488
352
536
300
492
348
492
348
488
352
488
352
488
352
488
348
488
352
488
352
488
352
488
348
488
352
492
348
488
352
492
348
488
348
488
352
488
352
488
352
488
352
488
348
540
300
492
348
488
352
488
352
488
348
492
348
1328
352
488
352
488
348
1328
352
488
352
488
352
488
352
484
352
488
352
488
352
488
348
492
348
492
348
488
352
448
392
532
304
492
348
492
348
488
352
488
352

(Learn how to use code tags Please!)

That signal is repeating itself 3 times..

I figured out that the variable was not being printed until it was full and that was my issue. turns out 584 is the correct value to use. I was able to find this by dumping the values into excel, dividing by 400 and rounding off. Much to my chagrin, that is the value listed in one of the threads I have listed above. Thanks for the help.