You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Sure, probably the easiest way is to just store the times in a second array. Try something like this:

    digitalWrite(B7, 0); // Set B7 to GND
    digitalWrite(A8, 1); // Set A8 to 3.3V
    // Because we're not using the module, we have to manually pull up the data pin
    pinMode(B6,"input_pullup");
    // Keep somewhere to put the signal times
    var times = [];
    var history = [];
    // now watch the input
    setWatch(function(e) {
      // work out how long the pulse was, in milliseconds
      var pulseLen = 1000 * (e.time - e.lastTime);
      // then save it, if it was less than 1 second
      if (pulseLen < 1000)
        times.push(pulseLen);
      else {
       history.push(new Float32Array(times));
        times = [];
      }
    }, B6, {repeat:true});
    

    That'll stick everything in history - it uses Float32Array to make sure it can fit a lot of IR recordings in if you need it.

    It's worth checking though - most IR remotes just repeat the same pattern over and over (rather than different ones)

About

Avatar for Gordon @Gordon started