You are reading a single comment by @dsample and its replies. Click here to read the full conversation.
  • I'm trying to make a fairly simple button which will turn both my TV and AV receiver off. This will help both myself and my wife make the quick transition from watching some TV to heading up to bed when our baby daughter starts crying.

    I've posted the code below, and after some experimentation with waiting between IR signals, I've got something working, but I have to hold the Puck really close to the devices for it to work. Is there some way to boost the IR signal (brightness of the IR LED?) or is it really for 'close range' connections?

    Gordon's examples of IR usually show his cheap IR lamp, but a lamp would usually be placed some distance from any button you'd want to control with, so although it's a visual example, it may be a bit contrived if it can't actually reach across a reasonable size room. I'm only trying to go about 2m (one through a glass door and have only managed to get it working successfully from about 20cm.

    var pronto = require ('pronto');
    
    var tvOff = pronto.decode('0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689'); // Samsung discrete Power Off
    
    var avOff = pronto.decode('0000 006c 0022 0002 0156 00ac 0016 0016 0016 0040 0016 0016 0016 0016 0016 0040 0016 0016 0016 0040 0016 0040 0016 0016 0016 0016 0016 0040 0016 0040 0016 0016 0016 0040 0016 0040 0016 0016 0016 0040 0016 0040 0016 0040 0016 0016 0016 0016 0016 0016 0016 0040 0016 0016 0016 0016 0016 0016 0016 0016 0016 0040 0016 0040 0016 0040 0016 0016 0016 0040 0016 05cc 0156 0055 0016 0e5d'); // Onkyo discrete Power Off
    
    var waitBetweenSignals = 250;
    
    var sendIRSignals = function(signals) {
      console.log('Sending IR');
      Puck.IR(signals.shift());
      if (signals.length > 0) {
        setTimeout(sendIRSignals, waitBetweenSignals, signals);
      }
    };
    
    var turnOff = function() {
      console.log('Turning off');
      sendIRSignals([tvOff, avOff]);
    };
    
About

Avatar for dsample @dsample started