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:
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:
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?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I have a TSOP31236 connected to a NodeMCU:
I am using the following code to record IR codes from the remote from my TV:
I press the Standbye-key on the remote and when I type console.log(times) I see the contents of the times-array:
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:
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?