You are reading a single comment by @navas and its replies. Click here to read the full conversation.
  • hi everyone,

    Does any know how to capture multiple IR codes through an IR receiver at the same time? My remote seems to send multiple codes on a single press. How do you capture them on times?

    This example is good to capture events one code at a time. I can print them to console using
    console.log(times.toString());

    but the problem is it is always printing the last one received.

    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 = [];
    // 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
        times = [];
    }, B6, {repeat:true});
    

    Thanks
    Navas

About

Avatar for navas @navas started