Avatar for Hapseleg

Hapseleg

Member since Apr 2018 • Last active Aug 2018
  • 3 conversations
  • 11 comments

Most recent activity

  • in ESP8266
    Avatar for Hapseleg

    Thank you so much for the very thorough explanation and the great tips. People such as you are those who make communities great :)

  • in ESP8266
    Avatar for Hapseleg

    Ah I see, everything works now as it should. Thank you very much!

    Do you recommend I always use onInit when I want to save code?

  • in ESP8266
    Avatar for Hapseleg

    Hi there, I am playing around with my DHT11 temperature sensor and my websocket server, I am using the Wemos d1 mini.

    Here is my code:

    var dht = require("DHT11").connect(D4);
    var WebSocket = require("ws");
    var wifi = require("Wifi");
    
    var WIFI_NAME = "MY WIFI NAME";
    var WIFI_OPTIONS = { password : "MY WIFI PASSWORD" };
    
    wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
      if (err) {
        console.log("Connection error: "+err);
        return;
      }
      console.log("Connected!");
      
      var host = "MY IP";
      var ws = new WebSocket(host,
        {
          path: '/',
          port: 80, // default is 80
          protocol : "echo-protocol", // websocket protocol name (default is none)
          protocolVersion: 13, // websocket protocol version, default is 13
          origin: 'Espruino',
          keepAlive: 600,
    (default is none)
        }
      );
    
      ws.on('open', function() {
        console.log("Connected to server");
    
    
        setInterval(function(){
          dht.read(function (a) {
            ws.send('{"temp":"'+a.temp.toString()+'"­,"rh":"'+a.rh.toString()+'"}');
          });
        },10000);
      });
    });
    

    Note: I have obviously hidden my wifi ssid, password and my IP in the code, just in case :)

    If I upload this to the Wemos it will work as it should, my websocket server is receiving the messages and will display the temperature and the humidity every 10 second the message is sent.

    But then once i save() this code onto the Wemos and reboot it, it starts showing this message every 10 second:

    Uncaught Error: This socket is closed.
     at line 2 col 26
    b,c+(this.masking?128:0)));126==c&&(this­.socket.write(h(a.le...
                             ^
    in function "send" called from line 1 col 69
    ...rh":"'+b.rh.toString()+'"}');
                                  ^
    in function "c" called from line 2 col 173
    ...or:0<e,raw:b,temp:-1,rh:-1})
                                  ^
    in function called from system
    

    What causes this problem? Seems like it has to do with the wifi module?
    I have tried restarting the server and also the Wemos but the problem persists.

    Thanks

  • in ESP8266
    Avatar for Hapseleg

    Problem found! Seems like one of the soldering's on the driver board was bad :) thanks for all the help once again!

  • in ESP8266
    Avatar for Hapseleg

    Got time to test it today and indeed the column of LED's did not light up... So it seems like there is a problem with my LED matrix or the MAX7219 driver board. Also I wanna say thanks for all the help guys! Really appreciate it!

  • in ESP8266
    Avatar for Hapseleg

    Haven't been able to test it yet but I was thinking, since it works with an Wemos d1 mini running Arduino code, shouldn't that indicate it's something to do with the software?

  • in ESP8266
    Avatar for Hapseleg

    Removing the intensity didn't help and it works just the same with ground connected or disconnected.
    Can I somehow check if the ground on the LED matrix is broke? I think I remember that all columns used to work

Actions