Avatar for aliustaoglu


Member since Aug 2018 • Last active Aug 2019
  • 0 conversations

Most recent activity

  • in ESP8266
    Avatar for aliustaoglu

    Yes I've been using this method all the time. It works pretty fine. I like using terminal and vscode so this approach suits me best. Also I like to have multiple files so I can make my system quite modular.

    I've also created an npm package. If you install this npm module globally you can create this boilerplate easily and then change it as you desire and have this structure. It supports both ESP8266 and ESP32. Module is here:


  • in ESP8266
    Avatar for aliustaoglu

    Espruino is a firmware you can flash into your ESP8266. You don't buy it. It's open source. There is official Espruino hardware you can buy. Probably they work more stable and you can get better support. But you can still use ESP8266.

  • in ESP8266
    Avatar for aliustaoglu

    Hi it's cuneyt. I just lost the access to the email I was registered with. So registered another account. Seems I'll be regular here. I liked this Espruino more than any other firmware. Not sure why it's called Espruino though. It should be called NodeMCU as it actually is the true Nodejs for MCU. Lua firmware should be called something else.

    Anyway, I finally managed to do what I was trying to do. Yes require works in a different way in Espruino. So if I use require to include other files it'll be a mess. Instead I should use uglify.js which just concatenates all files into a single file. Nothing else. Then I can use require for firmware libraries and online libraries.

    Please check my repo below to see how I use terminal. I use espruino npm package. You have all control over the code. It's awesome. Did not really use WebIDE but I'm sure it's using this library in the background in a similar way. It's good for starting but I wanna have more control over my library. And automate things.


    Here all files in the /src library bundled into a single file and minified. That's it. I just hate to put everything into a single file.

    "uglifyjs src/* --compress --mangle -o ./index.js "

    Put everything into index.js and upload index.js to ESP8266.

    And also I can use package.json to simplify frequently used commands like erasing or flashing the firmware, uploading the code etc.


    function ledStatus(status) {
      digitalWrite(2, status); // is called from httpServer


    function runServer() {
      var http = require('http');
        .createServer(function(req, res) {
          var status = req.url.replace('/?', '');
          if (status === 'on') ledStatus(0) // ledStatus is a function from led.js
          if (status === 'off') ledStatus(1)
          res.end('LED status = ' + status)

    Then when I connect to http://192.168.1.x:8080/?on the LED turns on and turns of when I navigate to http://192.168.1.x:8080/?off

    here is how I use my package.json

    "scripts": {
        "erase": "esptool.py --port /dev/cu.wchusbserial1420 erase_flash",
        "flash": "esptool.py --port /dev/cu.wchusbserial1420 --baud 115200 write_flash --flash_freq 80m  -fm dio --flash_size 4MB 0x0000 firmware/boot_v1.6.bin 0x1000 firmware/espruino_esp8266_user1.bin 0x3FC000 firmware/esp_init_data_default.bin 0x3FE000 firmware/blank.bin",
        "reset": "npm run erase && npm run flash",
        "reupload": "npm run reset && npm run upload",
        "uglify": "uglifyjs src/* --compress --mangle -o ./index.js ",
        "upload": "npm run uglify && espruino -p /dev/cu.wchusbserial1420 -b 115200 --board boards/ESP8266_4MB.json -e 'save()' index.js",
        "screen": "screen /dev/cu.wchusbserial1420 115200"