I have just received two NodeMCU boards and thanks to all the tutorials and great resources getting started with Espruino was a piece of cake - thank all of you for your efforts!
I've managed to read IR codes sent out by various remotes using the IRReceiver module and I would like to replay them using the board and an IR LED.
Unfortunately, however, (as it seems to me) I haven't been able to do so using analogWrite with a 38kHz frequency and digitalPulse. If I understand correctly, this is due to the lack of PWM support in Espruino for ESP8266, am I right? Although I've been using platforms like the Raspberry Pi etc. for several years, I'm quite new to the "low level stuff" and I'd just like to know, whether I got my head around this correctly.
Possibly related (?): PWM? Anyone ever get it working? Even via peek/poke directly at control registers?
Thanks in advance!
Yeah, the problem is that on ESP8266 there is no hardware PWM as far as I know. There is a hardware timer, but to make a pin change state you still need to do it using software. It means that realistically, reliable 38kHz soft PWM isn't an option right now.
Someone could write some IR transmitter code in C, and then call it from JS like is done with the Neopixels, but it's a bit of a faff. Even with that, you can't transmit for too long or you'll interfere with WiFi/trigger the watchdog timer.
The more sensible option is to use a microcontroller with hardware PWM on it, like the Espruino boards. I'll be releasing one with WiFi on soon now - I have hardware, there are just some software issues to sort out before I do a release.
Thanks for the quick reply, although that's a bit of a letdown, your announcement sounds promising ;)
I'll definitely give it a shot, since I really like the JS programming approach.
Hey @Gordon, is there any update yet? AnalogWrite for 38Khz is feasible in ESP8266?
It looked like there was a way to call code from IRQ but nobody has put any work into it as far as I know.
Also - on ESP8266, digitalPulse is a bit of a hack - it's synchronous, whereas the 'proper' one is async. Actually getting that working properly for ESP8266 could end up being a nightmare - as I guess you want to use this for IR.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem