• If you use console.log in a program but disconnect the program execution is blocked when the console buffer is full.

    For example:

    // Console.log blocks LED On/Off flashing when
    // disconnected
    
    var l=0;
    myinterval=setInterval(function () {
       digitalWrite(LED1,l=!l);
    }, 1000);
    
    var i=0;
    setInterval(function(){
      console.log(i);
      i++;
    },200);
    
    // load program
    // LED is pulsing On an dOff
    // Console is displaying the count in i
    // Disconnect the WebIde
    // The LED action stops
    // Reconnect the WebIde
    // Buffered count is displayed
    // LED resumes action
    

    and the output:

              |_| http://espruino.com
     1v95 Copyright 2017 G.Williams
    >
    =undefined
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Disconnected   ( the LED stops until reconnected)
    >
    12
    13
    14
    15
    16
    

    If you are using console.log to show the connection status etc. of a WiFi connection, disconnecting the WebIde will block the server.

    Not complaining about this, just posting to let others know about this gotcha.

About