Avatar for swaroop


Member since Oct 2017 • Last active Nov 2017
  • 2 conversations

Most recent activity

  • in ESP8266
    Avatar for swaroop

    I tried the example but that didn't work either. Infact the code didn't work on the desktop either.. When running like a Websocket client . I was getting a "invalid url" error on the desktop.

    I changed the code to what it is now and atleast it began working with a WebSocket server (code below) and the WebSocket client when both are running on the desktop

    var WebSocketServer = require('ws').Server,
        wss = new WebSocketServer({
            port: 8080
    wss.on('connection', function connection(ws) {
        ws.room = [];
        ws.send("User Joined");
        ws.on('message', function(message) {
            console.log("Msg from client - " + message);
            ws.send("Echo from Server " + message);
        ws.on('error', function(er) {
        ws.on('close', function() {
            console.log('Connection closed')
  • in ESP8266
    Avatar for swaroop

    I am trying to follow this example to setup a sample Websocket Client but the client won't connect nor does it thrown an error. None of the callback functions are ever called.

    I made sure that the WiFi is connected before the Websocket is initialized. The server doesn't see that the client running on Espruino on an ESP8266 is even connected. Does the built-in Websocket support the built in @require("Wifi") model?

    This same code runs fine when run from the Mac console when the websocket client is running inside the Mac and the server is also on the Mac.

    I have verified that the HTTP object is able to call another Web-server on the Mac.. So its definitely not a connectivity issue.

    Just need to know if the WebSocket object knows to utilize the connection as established by the Wifi.connect() API.

      var host = "ws://";
      var ws = new WebSocket(host);
      ws.on('open', function() {
        console.log("Connected to server");
        setTimeout(saySomething, 5000);
      ws.on('message', function(msg) {
        console.log("MSG: " + msg);
        setTimeout(saySomething, 5000);
      ws.on('close', function() {
        console.log("Connection closed");
      ws.on('handshake', function() {
        console.log("Handshake Success");
      ws.on('ping', function() {
        console.log("Got a ping");
      ws.on('pong', function() {
        console.log("Got a pong");
      ws.on('rawData', function(msg) {
        console.log("RAW: " + msg);
      function saySomething() {
  • in ESP8266
    Avatar for swaroop

    Woot!.. that is good news.

    It was documented on the ESPTool page

    Most boards use qio mode. Some ESP8266 modules, including the ESP-12E
    modules on some (not all) NodeMCU boards, are dual I/O and the
    firmware will only boot when flashed with --flash_mode dio. Most ESP32
    modules are also dual I/O.

  • in ESP8266
    Avatar for swaroop


    I've made some progress on this. Please refer to my post.

  • in ESP8266
    Avatar for swaroop

    Update 1 - I still haven't been able to run this through the ThingsSDK CLI. It still says "Cannot connect" to the same port. Even though i have disconnected that from the Espruino Web IDE

  • in ESP8266
    Avatar for swaroop

    @stevo Updated with another post below. Hope that gets your work going too!

  • in ESP8266
    Avatar for swaroop

    I have a new development.. I've kept trying the same steps but for some reason it started working. I will try to re-create the steps and post back with another update. So what i recall to have done was

    1. Follow this article and downloaded this espruino_1v94.154_esp8266_4mb.tgz file.
    2. Tried to get an older boot1.4(b1).bin from a ESP8266 firmware - but this did not work and had the same issue.
    3. Went back to use the boot_v1.6.bin which was there in the original espruino package and used esptool.py to flash the ESP8266. I modified this slightly to mention --flash_size as 4MB instead of 32m (this comes as a warning, so i've modified that).
    4. Flash the ESP8266
      > esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 erase_flash

    Important step here is to disconnect and re-connect the ESP8266 from the USB.

    1. Burn the downloaded image

    esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash
    --flash_freq 80m --flash_mode qio --flash_size 4MB 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000
    esp_init_data_default.bin 0x3FE000 blank.bin

    1. Opened up Espruino IDE and connected to 1 of the 2 USBtoUART options that it always displays. And ran the sample code.

    var wifi = require("Wifi");
    wifi.connect("my-ssid", {password: "my-password"}, 
    function(err){if(err)console.log(err);elĀ­se console.log("connected!");})

    and it started working. I am still testing out other APIs.. Another sample that i was able to do was

    This blinks the onboard LED ON and OFF every 500ms.

    var isOn = false;
    var interval = 500;
    function main() {
        setInterval(function () {
            isOn = !isOn;
            digitalWrite(D2, isOn);
        }, interval);
  • in ESP8266
    Avatar for swaroop

    I've got 2 Node MCU ESP8266's and I believe both of them are a 12E too. I dont have a link to share as i bought them off from a local store.

    But on one, i have the Amica branded one (the other one was a GPIO chart behind, no brand). which mentions "Use 9600 baud rate"

    I was able to program these two devices in Arduino IDE and work with various sensors too.

    About Espruino Web IDE, i have the same behavior as you described above. Not responding.

    i'll look for the older boot_v1.5.bin. Perhaps these should be a part of the Older Espruino releases v1.87 ?