You are reading a single comment by @sebi and its replies. Click here to read the full conversation.
  • That day I was experimenting with the 2x3 Pixel Clock accessible at https://banglejs.com/apps/#clock. Just click on the Try in Emulator icon and it will bring you there. Code line number 28 will match.

    But really, my issue occurs whatever the code in the right hand side panel is (the panel can be empty). It occurs when I want to connect the WebIDE to the Emulator (Connect / Disconnect plug icon > Emulator). At this stage, I am not uploading any code from the right hand side panel into the emulator yet.

    Do you see the above code block with a fresh start of the browser pointing to http://www.espruino.com/ide/ ?

    What I see is the latest code I played with: currently it is code of the 2x3 Pixel Clock. If I clear cookies and other site data from Chrome, I get this in the WebIDE right hand side panel:

    var  on = false;
    setInterval(function() {
      on = !on;
      LED1.write(on);
    }, 500);
    

    ...which is the panel default content I guess. But when trying to connect to the Emulator, the problem of getting a white emulator window still occurs.

  • Reply to post #52

    'That day I was experimenting with the 2x3 Pixel Clock'

    Thank you, that clears that up.

    'At this stage, I am not uploading any code from the right hand side panel into the emulator.'

    Now this statement might be key here.

    As when I click the Orange 'Connect' button and then select 'Emulator' from the modal dialog, the code block on the R-Hand editor side of the IDE is then viewable in the pop-up Emulator Window.

    Please try cut-n-paste the following:

    Bangle.setLCDPower(1);
    Bangle.setLCDTimeout(0);
    
    var scenes = [
      function() {
        y = -100;
        var step = 4;
        var i = setInterval(function() {
          y+=step;
          if (y>70) {
            clearInterval(i);
            
            i = undefined;
          }
          g.clearRect(0,y-(step+1),240,y-1);
          g.drawImage(Bangle.getLogo(),0,y);
        }, 20);
        Bangle.setLCDMode();
        g.clear();
        return function() {
          if (i) clearInterval(i);
        };
      },
      function() {
        var txt = [" ____                 _ \n"+
              "|  __|___ ___ ___ _ _|_|___ ___ \n"+
              "|  __|_ -| . |  _| | | |   | . |\n"+
              "|____|___|  _|_| |___|_|_|_|___|\n"+
              "         |_| espruino.com\n\n",
        "The JavaScript Interpreter for uCs\n",
        "  * On-chip JS Interpreter",
        "  * GPS, Acclerometer, Compass",
        "  * 64 MHz, 64kB RAM, 512kB + 4MB Flash",
        "  * 240x240 IPS LCD",
        "  * Speaker & Vibration motor",
        "  * Bluetooth LE",
        "  * 1 week battery life",
        "",
        "Includes:",
        "  * Tensorflow AI",
        "  * Bluetooth LE central & periph",
        "  * Graphics Library",
        "  * VT100 terminal",
        "","",""
        ];
        var n=0;
        var i = setInterval(function() {
          Terminal.println(txt[n]);
          n++;
          if (n>=txt.length) {
            clearInterval(i);
            i=undefined;
          }
        }, 200);
        Bangle.setLCDMode();
        return function() {
    
    
          if (i) clearInterval(i);
        };
      },
      function() {
        var img = require("heatshrink").decompress(atob("o­NBxH+5wA/AH4A/AH4A/AH4A/AH4A/AH4A/AH4A/A­H4A/AH4A/AH4A/AH4A/AH4A/AH4A/AH4A/AH4A/A­HGpAAoQKv4ADCBQAeqsrAAejBw9/B4oABqt/IGep­Hw5CEQspALH5hBC5pAvv4/MAALFkIBWpPI6IHqpA­u0Z3GfYOpRYdPQEhALYIp2FBYNVI4JAvvL4LH0yB­YAFJAQQQ5Ay1JAFftBAQBYxCDv+qIGiCHIQiGnIB­fOv5BJIQRAyIJkrvKEkIBrFBB4qEGIGRCNYsZAQI­QV/IZDEiICRCDQVJAUIQVPC4lVIF6yJQYpAZ5t/F­YvNIBepqtVIJGjIDoqBDY2pdYo3DfAhBIQLmpvIc­DvIrC5oJEIAhTCGQmj5qgEC4t5e7YrBqt5BI6UFB­g15v4XHbQwAQb4oAKv7NKABdVRoYATUAwnICqjZF­IMdVE4+jXI4XGYCxBFFZN/M5OpCxUrvJ/ZFYmjvN­VAAY+KCwpDBC6YAV5vNC9oA/AH4A/AHYA=="));
    
        g.clear();
        y = 0;
        var step = 4;
        var i = setInterval(function() {
          y+=step;
          g.clear();
          g.drawImage(img,60,60,{rotate:Math.sin(y­*0.03)*0.5});
          g.flip();
        }, 20);
        Bangle.setLCDMode("120x120");
        return function() {
          if (i) clearInterval(i);
        };
      },
      function() {
        var rx = 0, ry = 0;
    
        // draw a cube
        function draw() {
          var rcx=Math.cos(rx),
            rsx=Math.sin(rx),
            rcy=Math.cos(ry),
            rsy=Math.sin(ry);
          // Project 3D coordinates into 2D
          function p(x,y,z) {
            var t;
            t = x*rcy + z*rsy;
            z = z*rcy - x*rsy;
            x=t;
            t = y*rcx + z*rsx;
            z = z*rcx - y*rsx;
            y=t;
            z += 6;
            return [240 * (0.5 + x/z), 240 * (0.3 + y/z)];
          }
    
          var a;
          // draw a series of lines to make up our cube
          a = p(-1,-1,-1); g.moveTo(a[0],a[1]);
          a = p(1,-1,-1); g.lineTo(a[0],a[1]);
          a = p(1,1,-1); g.lineTo(a[0],a[1]);
          a = p(-1,1,-1); g.lineTo(a[0],a[1]);
          a = p(-1,-1,-1); g.lineTo(a[0],a[1]);
          a = p(-1,-1,1); g.moveTo(a[0],a[1]);
          a = p(1,-1,1); g.lineTo(a[0],a[1]);
          a = p(1,1,1); g.lineTo(a[0],a[1]);
          a = p(-1,1,1); g.lineTo(a[0],a[1]);
          a = p(-1,-1,1); g.lineTo(a[0],a[1]);
          a = p(-1,-1,-1); g.moveTo(a[0],a[1]);
          a = p(-1,-1,1); g.lineTo(a[0],a[1]);
          a = p(1,-1,-1); g.moveTo(a[0],a[1]);
          a = p(1,-1,1); g.lineTo(a[0],a[1]);
          a = p(1,1,-1); g.moveTo(a[0],a[1]);
          a = p(1,1,1); g.lineTo(a[0],a[1]);
          a = p(-1,1,-1); g.moveTo(a[0],a[1]);
          a = p(-1,1,1); g.lineTo(a[0],a[1]);
        }
    
        // rotate and redraw the cube
        function step() {
          // rotate
          rx += 0.1;
          ry += 0.11;
          // draw
          g.clear();
          g.setColor(0xFFFF);
          draw();
          g.flip();
        }
    
        Bangle.setLCDMode("doublebuffered");
        g.clear();g.flip();
        var i = setInterval(step,50);
        return function() {
          clearInterval(i);
        };
      },
      function() {
        var img = require("heatshrink").decompress(atob("o­NBxH+5wA/AH4A/AH4A/AH4A/AH4A/AH4A/AH4A/A­H4A/AH4A/AH4A/AH4A/AH4A/AH4A/AH4A/AH4A/A­HGpAAoQKv4ADCBQAeqsrAAejBw9/B4oABqt/IGep­Hw5CEQspALH5hBC5pAvv4/MAALFkIBWpPI6IHqpA­u0Z3GfYOpRYdPQEhALYIp2FBYNVI4JAvvL4LH0yB­YAFJAQQQ5Ay1JAFftBAQBYxCDv+qIGiCHIQiGnIB­fOv5BJIQRAyIJkrvKEkIBrFBB4qEGIGRCNYsZAQI­QV/IZDEiICRCDQVJAUIQVPC4lVIF6yJQYpAZ5t/F­YvNIBepqtVIJGjIDoqBDY2pdYo3DfAhBIQLmpvIc­DvIrC5oJEIAhTCGQmj5qgEC4t5e7YrBqt5BI6UFB­g15v4XHbQwAQb4oAKv7NKABdVRoYATUAwnICqjZF­IMdVE4+jXI4XGYCxBFFZN/M5OpCxUrvJ/ZFYmjvN­VAAY+KCwpDBC6YAV5vNC9oA/AH4A/AHYA=="));
    
        g.clear();
        y = 0;
        var step = 4;
        var i = setInterval(function() {
          y+=step;
          g.scroll(0,1);
          g.drawImage(img,Math.random()*240,Math.r­andom()*240,
            {rotate:Math.random()*6.3, scale:0.5+Math.random()});
        }, 1);
        Bangle.setLCDMode();
        return function() {
          if (i) clearInterval(i);
        };
      }
    
    ];
    var sceneNo = scenes.length-1;
    
    var stop;
    function next() {
      sceneNo++;
      if (sceneNo>=scenes.length) sceneNo=0;
      if (stop) stop();
      clearInterval();
      stop = scenes[sceneNo]();
      setTimeout(next, 10000);
    }
    next()
    
    
About

Avatar for sebi @sebi started