• I have a TSOP31236 connected to a NodeMCU:

    • Ground to NodeMCU Gnd pin
    • VCC to NodeMCU 3.3V pin
    • Data to NodeMCU D1 pin

    I am using the following code to record IR codes from the remote from my TV:

    // https://www.espruino.com/Pico+Infrared
    
    pinMode(NodeMCU.D1,"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 = [];
    }, NodeMCU.D1, {repeat:true});
    

    I press the Standbye-key on the remote and when I type console.log(times) I see the contents of the times-array:

    [ 2.69600000001, 0.853, 0.48300000003, 0.84700000002, 0.47899999992, 0.40800000010, 0.47899999992, 0.40800000010, 1.36699999995, 1.29399999991, 0.48100000003, 0.406, 0.48100000003, 0.406, 0.48200000003, 0.405, 0.48199999991, 0.40500000011, 0.48300000003, 0.40499999988, 0.48200000003, 0.40499999988, 0.48300000003, 0.40400000011, 0.48299999991, 0.40400000011, 0.48299999991, 0.404, 0.48399999991, 0.404, 0.48300000003, 0.40400000011, 0.92199999983, 0.41000000010, 0.48800000001, 0.84199999992, 0.48400000002, 0.404, 0.48400000002, 83.35299999998, 2.703, 0.84700000002, 0.51, 0.82, 0.48499999991, 0.402, 0.48599999990, 0.40100000012, 1.37300000005, 1.28699999993, 0.48799999990, 0.4, 0.48800000001, 0.39900000001, 0.48800000001, 0.39899999990, 0.47800000004, 0.40900000010, 0.48899999990, 0.39900000001, 0.48800000001, 0.39900000001, 0.48900000001, 0.39799999990, 0.47900000004, 0.40800000010, 0.47899999992, 0.408, 0.48, 0.408, 0.47900000004, 0.40799999987, 0.92900000004, 0.403, 0.48400000002, 0.84700000002, 0.47900000004, 0.40699999988, 0.48 ]
    

    So, the receiving part seems to work.

    Now from this page I found that you can send the times-array to an IR transmitter led. I have connected an IR led to pin NodeMCU.D2 and NodeMCU ground and use the following command to submit the times-array to my TV:

    pinMode(NodeMCU.D2, "output")
    digitalPulse(LED1,1,times);
    

    Nothing seems to happen, at least the TV doesn't switch off or on. When I exchange the IR led with a normal led I see that there are pulses sent out. Any idea what could be wrong or does anyone have working code with Espruino on an ESP8266?

About