You are reading a single comment by @AkosLukacs and its replies. Click here to read the full conversation.
  • The nodeMCU resets, because the ESP8266 has a watchdog, and the while loop prevents control returning to the underlying Espressif OS. But I'm pretty sure it would mess up USB and Bluetooth communications as well. Also, even a simple uart buffer - that uses HW uart & buffer - could overflow in a couple of seconds.

    Almost wrote that there could be a "main loop a'la arduino" thing in Espruino-Blockly, that emulates the expected behaviour. But the purist inside me thinks that kids mind should not contaminated be by seeing a blocking wait call on a microcontroller. Or actually in any code. Even if everybody seem to do that.
    Did you know that god kills a kitten when you use blocking wait in any code? :O

    Instead if the while(true) block, you can use the run code every X seconds block I guess.

  • why is it a poison for kids? some language supports the wait function, why limit event based javascript to the mind of a kid?
    it is all about the interpreter

    also with ES7 it can support async and await, is it really a poison?

  • there are times we need for loop and have wait for seconds within it

    kids do not know about multithread etc, why limit their mind and treat "wait/sleep" as abnormal

About

Avatar for AkosLukacs @AkosLukacs started