• I just merged in my changes to allow multiple different connection types.

    The Web IDE and instructions on installing the development version from GitHub are here.

    It's a bit of a change so it'd be great if some of you could help to try it and make sure that connection and disconnection to your Espruino still works as expected.

    Connect over TCP/IP

    If you go into Settings then Communications then enter an address in Connect over TCP Address, next time you click connect you'll see an option to connect to Espruino via TCP/IP.

    This is probably of a lot of interest to @Kolban, @JumJum, and @tve as it'll work on the ESP8266 firmware (when the Telnet interface gets done).

    However for the rest of us, we can still program our Espruinos wirelessly by uploading the following code (this assumes a new ESP8266 v0.25 and a Pico - but you can change the network code and it should work for anything - the important bit is between the // ----- lines.

    digitalWrite(B9,1); // enable on Pico Shim V2
    Serial2.setup(115200, { rx: A3, tx : A2 });
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
      if (err) throw err;
      wifi.reset(function(err) {
        if (err) throw err;
        console.log("Connecting to WiFi");
        wifi.connect(WIFI_NAME, WIFI_KEY, function(err) {
          if (err) throw err;
          console.log("Connected");
          wifi.getIP(print);
          // -----
          require("net").createServer(function (connection) {
            connection.pipe(LoopbackA);
            LoopbackA.pipe(connection);
            LoopbackB.setConsole();
          }).listen(23);
          // -----
        });
      });
    });
    
    function reset() {
      clearInterval();
      clearWatch();
      console.log("Can't reset properly - we'd break the network.");
    }
    

    So upload via USB, wait until it gives you the IP address and type that with :23 on the end into Connect over TCP Address in Settings -> Communications. You can then connect with the terminal.

    Connect over Audio

    You can enable this from Settings as well. I'll document it properly, but for now you can find details of the simple circuit you need here: https://github.com/espruino/EspruinoOrio­n#how-it-works

    It's potentially of use for you in the Web IDE if:

    • You want to talk to a board without USB, and you don't have a USB-TTL converter (like the STM32VLDISCOVERY board)
    • You bought one of those stupid new MacBooks with no USB Type A connectors

    But the big one is that you can run the Web IDE in the browser, and can program your Espruino board with no drivers or anything.

    Please help to make this better - it's pretty awesome that you can now theoretically run the Web IDE instantly from anywhere, without drivers, including Android and iOS. It just needs a bit more work put into it and I have very little time.

    The Web IDE is all HTML, JS, and CSS - so it shouldn't be completely daunting.

  • IDE in the browser looks great! "Flash" menu option in settings is a dead link - maybe on purpose, and I couldn't see the "Connect over TCP address" option, but in the other post you mentioned audio only currently, so probably expected - but not clear in this thread.

    Also following what @Kolban, @JumJum, and @tve are doing with Espruino and the ESP8266, in here and on Gitter.

  • The "Connect over TCP address" is present in the downloaded Google App and seems to work great when connected to a Telnet server. I am now looking to @Gordon for some quick answers to some questions I have to get that enabled in the ESP8266 port ... but it looks like it is all going to come together nicely.

  • For anyone needing it, you can use

    var fullreset = reset;
    

    before the "function reset()" line to preserve the reset function. Then just call fullreset() to reset your espruino.
    EDIT: Make that:

    if(!fullreset) {var fullreset = reset}
    

    :S Managed to overwrite fullreset.

  • Having a bit of a bit of a go with this, it's working pretty well. The only traps have been losing the reset function and having trouble when accidentally calling some of the network code twice.

    It'd be pretty easy to write a function to parse the output of getCached() and remove all modules not needed for network. Add something similar for variables and functions, and you'd have a selective reset(), letting you remove everything except your network connection. Turn it into a module, and you have a javascript-only one-line version of "setBootupCode". Thanks @Gordon!

  • For the wiznet, this is what I use:

    function onInit() {
      // Ethernet Card
      SPI2.setup({ mosi:B15, miso:B14, sck:B13 });
      var eth = require("WIZnet").connect(SPI2, B10);
      eth.setIP();
      global.eth = eth;
      
      // Prevent reset
      function softreset() {
        clearInterval();
        clearWatch();
        Object.keys(global).forEach(function(n) {
          if(n!="onInit" && n!="Ethernet" && n!="Server" && n!="Socket" && n!="Serial" && n!="Pipe" && n!="LoopbackA" && n!="LoopbackB" && n!="eth" && n!="fullreset" && n!="reset") {
            delete global[n];
          }
        });
        console.log("Can't reset properly - we'd break the network. Use fullreset() instead.");
      }
    
      // Telnet Server
      require("net").createServer(function (connection) {
        connection.pipe(LoopbackA);
        LoopbackA.pipe(connection);
        LoopbackB.setConsole();
        if(!global.fullreset) {
          global.fullreset = global.reset;
          global.reset = softreset;
        }
      }).listen(23);
    }
    
    //save();
    

    (Updated with Gordon's tip)

  • Thanks for posting it up!

    You might find you can add:

    Object.keys(global).forEach(function(n) { 
      if (n!="onInit" && n!="reset") delete global[n]; 
    });
    

    To remove most of the other things that might have got defined before?

  • runs on ipad too, but

    SETTINGS -> COMMUNICATIONS : is missing "Connect over Audio"

    would be great to have ;-)

    SETTINGS -> FLASHER : is dead

    ok no problem, can be remove for ipads

  • A modern iPad? If the text doesn't appear it's because the device doesn't support the Web Audio API: https://developer.mozilla.org/en-US/docs­/Web/API/Web_Audio_API

  • it is a ipad air 2 and plays this very well
    https://forestmist.org/share/web-audio-a­pi-demo
    does the IDE check for plugged connector ?

  • No... it shouldn't. If you can get a console from the web browser then you might be able to see what's going on. Maybe try: http://stackoverflow.com/questions/44782­71/remote-console-log-on-ios-devices

  • Found a bug in Array.indexOf implementation.
    Only strings less than 5 characters matches.

      global.keep = ["keep", "onInit", "SPI", "SPI2", "Ethernet", "eth", "Server", "Socket", "Serial", "Pipe", "LoopbackA", "LoopbackB", "fullreset", "reset"];
      function softreset() {
        Object.keys(global).forEach(function(n) {
          console.log("-"+n+"-");
          console.log(global.keep.indexOf(n));
        });
    

    Should I open a new topic?

  • On the latest version 1v82 of Espruino?

    var foo = ["keep", "onInit", "SPI", "SPI2", "Ethernet", "eth", "Server", "Socket", "Serial", "Pipe", "LoopbackA", "LoopbackB", "fullreset", "reset"];
    foo.forEach(function(n) {
      console.log(n, foo.indexOf(n));
    });
    
    keep 0
    onInit 1
    SPI 2
    SPI2 3
    Ethernet 4
    eth 5
    Server 6
    Socket 7
    Serial 8
    Pipe 9
    LoopbackA 10
    LoopbackB 11
    fullreset 12
    reset 13
    

    So for me, that works perfectly. I tried it with Object.keys(global) too and it works fine.

  • But yes, if you could open a new topic for it, that'd be great.

  • I would like to be able to reconnect via serial after tcp connection has closed, it there a way to do it?

    // Telnet Server
      require("net").createServer(function (connection) {
        connection.pipe(LoopbackA);
        LoopbackA.pipe(connection);
        LoopbackB.setConsole();
        connection.on('close', function() {
          // TODO
        });
        if(!global.fullreset) {
          global.fullreset = global.reset;
          global.reset = softreset;
        }
      }).listen(23);
    
  • Moved.

  • this is the error list after loading:


    1 Attachment

    • Bildschirmfoto 2015-11-24 um 22.20.15.jpg
  • Moved.

  • Try now? Looks like I had the Web IDE repo using the wrong version of EspruinoTools

  • did, now i get that:


    1 Attachment

    • Bildschirmfoto 2015-11-25 um 16.50.03.JPG
  • Ok, well those might stop it from working, but I can't see a reason why the audio option wouldn't appear.

    Are you able to get the full contents of the console, rather than just the errors?

  • hope is is helpful enough


    5 Attachments

    • Bildschirmfoto 2015-11-25 um 22.41.17.JPG
    • Bildschirmfoto 2015-11-25 um 22.41.06.JPG
    • Bildschirmfoto 2015-11-25 um 22.39.46.JPG
    • Bildschirmfoto 2015-11-25 um 22.55.31.JPG
    • Bildschirmfoto 2015-11-25 um 22.56.02.JPG
  • Yes, the No navigator.getUserMedia log message is the problem there.

    Looking at the demo which does work, it doesn't do any recording. Maybe if you can find a getUserMedia demo that works online I can see what they do differently, but I think in all likelihood, Apple have chosen not to implement it on iOS.

  • YES, it is what it is: a dead end for ipads and iphones for now

    check this answers:
    http://stackoverflow.com/questions/29160­819/how-to-use-getusermedia-in-chrome-fo­r-ios

    can someone please add a note to the readme.md that it is not working on ipads ans iphone for now - thanks.

  • Thanks, just done. It would actually be possible to come up with a new one-way serial driver for the online Web IDE, which would work on iOS - but then you don't get the serial console or any of the stuff that goes with that.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

New Web IDE in GitHub (connect over TCP/IP and Audio, RUN IT ONLINE)

Posted by Avatar for Gordon @Gordon

Actions