You are reading a single comment by @MattC and its replies. Click here to read the full conversation.
  • I'm trying to get the IR timings from a Remote and play them back using Puck.IR

    I got the correct times from a website and they work using Puck.IR but I cannot get the correct timings using times recorded from a connected IR Receiver, I have a few different IR receivers and they all give more or less the same result - firmware was 1.89 and also tested with the new beta 1.89.35

    I've been using the examples given on the site, 1 issue i've noticed is when using this snippet

    pinMode(D1,"input_pullup");
    
    var times =[];
    
    var currentWatch;
    
    function startWatching() {  
      currentWatch = setWatch(function(e) {
        
        var pulseLen = (e.time - e.lastTime);
         
        if (pulseLen < 1000) {
          times.push(pulseLen);
        } else {
          times = [];  
        }
      }, D1, {repeat:true});
    }
    startWatching();
    
    function stopWatching() {
      clearWatch(currentWatch);
      currentWatch = null;
    }
    

    The times given back are to max 3 decimal places e.g. [ 0.009, 0.004, 0.001, 0, 0.001, 0.001, 0, 0.002, 0, ... Is this expected behavior from e.time and e.lastTime? It's not really accurate enough for this.

    I set up my own timers using the onPulseOn and OnPulseOff examples (https://www.espruino.com/Infrared+RemoteĀ­+Control) and get better accuracy, however these still do not work when played back and are quite a bit different to the ones i got off the website

    Website times (ms): 9.024 ,4.512 ,0.564 ,0.564 ,0.564 ,0.564 ,0.564 ,1.692 ,0.564

    Puck recorded times (ms): 8.9993, 4.57763671875, 0.9765625, 1.06811523437, 0.94604492187, 1.0986328125, 0.91552734375, 1.12915039062, 0.91552734375

    Any help would be appreciated

About

Avatar for MattC @MattC started