-
• #3
Also on the page @MaBe mentions is :
http://www.espruino.com/pronto
http://irdb.tk contains a list of common remote control codes for different devices.
So you can look up your tv, get the code and try using the pronto library...
-
• #4
Thank you for your suggestions @MaBe and @Wilberforce.
First I tried to fix the pulse times from the receiver to 1 decimal, but that didn't work.
Next I wanted went the Pronto-way. I found codes for my TV, but run into a problem with the Pronto module:
>var p=require("pronto") WARNING: Module "pronto" not found =undefined >
I found the pronto module on the Espruino site and took the function to decode the hex-string and used it to send to to my TV with digitalPulse... To no avail.
Has anyone ever got this to work with a NodeMCU?
-
• #5
The IR page you linked also mentions a whole bunch of other stuff you need - specifically
analogWrite
on the other pin the IR LED is connected to.There are a few posts on the ESP8266 forum about this already, but basically the code given won't work on ESP8266 because there's no way of getting a 40kHz square wave at the same time as executing digitalPulse.
The solutions for you would be to:
- Use a proper Espruino device.
- Set up a 555 timer to give you a 40kHz signal as well.
- Build a new array that contained a series of 40kHz pulses, instead of your current ~1-2ms pulses - see the attached image from eevblog
1 Attachment
- Use a proper Espruino device.
-
• #6
Thank you @Gordon!
Hmmm, maybe this way is over my head then...
I have an Espruino, so I might try to go that way first but the idea was to build this into an iTead S20 smartswitch so I think that the other options (555 timer or an array with 40khz pulses) would better suit me.
Any pointers on how to generate such an array or do you have a link to the page where you found the above image @Gordon?
Much appreciated!
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?