Avatar for cuneyt

cuneyt

Member since Aug 2018 • Last active Aug 2018
  • 1 conversations
  • 3 comments

Most recent activity

  • in ESP8266
    Avatar for cuneyt

    Thanks for the answers. So, if bundling not needed that means I need to upload the file which is the starting point of my app. Like index.js or app.js in a single page app. As I require files espruino will pack them all together and as I understand.

    I don't use the IDE. I use normal text editor and then use command line like below. Works good.

    espruino led.js -p /dev/cu.wchusbserial1420 -b 115200 --board ESP8266_4MB.json

    One thing I don't understand is what happens when I upload another file? It does not seem to overwrite the existing program. For example; I first uploaded led.js which just turns on the builtin LED.

    digitalWrite(2, 1)
    

    Then I wrote another program which is client.js and does completely something different:

    var http = require("http");
    http.get("http://www.espruino.com", function(res) {
      res.on('data', function(data) {
        console.log(data);
      });
    });
    

    What I expect; when I upload the second program, the first one will be overwritten therefore LED would turn off. But it doesn't. It seems it ignores the second program. I need to re-flash the firmware if I want to change the program inside.

  • in ESP8266
    Avatar for cuneyt

    OK thanks. I am actually using npm library from the console. Pretty powerful. So, if there's only one file I think the best option is to bundle the files and minify into a single file. Actually it's a good idea to have a single file. You can do many optimisations using Grunt and that kind of bundlers.

    Thanks I just wanted to make sure that it is the only way. Now I'm more clear on what I'm going to do. Cheers.

  • in ESP8266
    Avatar for cuneyt

    I have been working with Arduino and MicroPython for a while and just switched to Espruino and nodejs on ESP8266. I am able to upload a file and connect to wifi and do lots of stuff. But there's one thing I cannot figure out:

    MicroPython had a file structure like below:

    • boot.py
    • main.py
    • mylibrary.py

    as the name suggests boot.py is executed on boot, and main.py is the main file where you want to create your main loop. I can create another library and import it from main.py. Arduino also has similar structure. How can I do this in Espruino? Can I upload multiple files? If so how?

Actions