Copyright ©

Mongoose OS Forum

ATTENTION! This forum has moved to:

Do not post any new messages.

Output toggle loop hangs the system on beta4

ZanderoxZanderox USA
edited May 2016 in Mongoose OS

This simple output toggle loop hangs the system on beta4. Kills the AP as well. It runs for a few seconds before the hang. Same results with GPIO 0 and GPIO 2.

while(true) {
GPIO.write(2, true);
GPIO.write(2, false);


  • I can say more,
    while(true) {}; will kill system as well.
    ESP8266 works in cooperative multitasking mode,
    try to rewrite you code in this way:

    setTimeout(function() { GPIO.write(2, ! }, 100);
  • Ah, yes. Kick watchdog Sys.wdtFeed() would also fix this. Interesting that nodemcu doesn't hang with similar loop. Guess they manage watchdog differently, if at all.

  • SergeySergey Dublin, Ireland
    edited June 2016

    We intentionally do not feed watchdog from within the interpreter, relying on developers knowing what they do. Busy loop in C is going to hang the system for the same reason.

Sign In or Register to comment.