-
• #2
Well... This seems to be an issue with pin 1 on the ESP8266?
-
• #3
The first code example surprise me a bit by what it should do...
For ten seconds, every five (5) milliseconds it logs "foo ". On the 1000th time, something after five (5) seconds, it turns the pin on.
The hanging to me means that something with the buffers goes hi wire, because of all the logging...
What is the reason for the loop? ...are you trying to reinstate Arduino on an event driven system?
The second piece of code does it 100 times slower: every 500 milliseconds, it does log something... and the rest of the time it is sleeping. Less than a percent - probably 1/2 a percent as busy as the first code...
Could it be that the system crashes and reboots?... I would be surprised...
PS: ...not Espruino hangs, but ESP8266 Wifi stack puts an end to this...?
-
• #4
It's pin 1. Check out: http://www.espruino.com/EspruinoESP8266#pinout
Pin 1 is D1 - which is USART1_TX. That's the pin that's used by Espruino to output the REPL.
So if you write to it, it stops Espruino being able to print anything to the REPL any more. It's still working, it's just not printing anything.
-
• #6
Honestly, I'm not sure why the second would appear to be ok - I'd have thought it would cause the same problems.
-
• #7
Thanks! That is what I found out through trial and error. I forgot to look at what else that pin did.
When I try to change a pin's mode inside a setInterval after a number of loops Espruino hangs.
For example:
It will turn the pin off and log
foo 999
. It will never logfoobar
.The odd thing is that I can create a blink loop with setInterval like this:
Any help would be great!