You are reading a single comment by @countxerox and its replies. Click here to read the full conversation.
  • Hi, I'm trying to add a BH1750 sensor to measure light intensity but now when I send the form, after one succesfull send, I get errors...

    _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v91 Copyright 2016 G.Williams
    >
    =undefined
    Saving key
    Saving cert
    Saving ca
    Done!
    >save()
    =undefined
    Erasing Flash.....
    Writing............................
    Compressed 81600 bytes to 26255
    Checking...
    Done!
    Running onInit()...
    Connecting to WiFi
    192.168.1.68
    Connecting to Google
    Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    Performing the SSL/TLS handshake...
    >Verifying peer X.509 certificate...
    Connected to Google
    Google connection closed, 65577 bytes received
    process.memory();
    ={ "free": 3919, "usage": 1181, "total": 5100, "history": 1,
      "stackEndAddress": 536958444, "flash_start": 134217728, "flash_binary_end": 378496, "flash_code_start": 134234112, "flash_length": 393216 }
    Connecting to Google
    Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    ERROR: Failed! mbedtls_ssl_setup: Not enough memory
    ERROR: Unable to create socket
    Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    ERROR: Failed! mbedtls_ssl_setup: Not enough memory
    ERROR: Unable to create socket
    >process.memory();
    ={ "free": 3868, "usage": 1232, "total": 5100, "history": 1,
      "stackEndAddress": 536958444, "flash_start": 134217728, "flash_binary_end": 378496, "flash_code_start": 134234112, "flash_length": 393216 }
    

    but it seems like there is enough memory. I don't understand what I've done wrong.

    function onInit() {
    
      I2C3.setup({sda:B4,scl:A8});
      var bh=require("BH1750").connect(I2C3);
      bh.start(3);
      
      var dht = require("DHT11").connect(B5);
      
      clearInterval();
      // initialise the ESP8266, after a delay
      setTimeout(function() {
        
        Serial1.setup(115200, { rx: B7, tx : B6 });
        wifi = require("ESP8266WiFi_0v25").connect(Seri­al1, function(err) {  
          if (err) throw err;
          console.log("Connecting to WiFi");
          wifi.connect("xxxx", "xxxx", function(err) {
            if (err) throw err;
            wifi.getIP(function(e,ip) {
              LED2.set();
              console.log(ip);
              setInterval(function() {
                dht.read(function (a) {
                  sendForm(a.temp.toString(), a.rh.toString(), Math.round(bh.read()).toString());
                });
              }, 60000); // once a minute
            });
          });
        });
      }, 2000); 
    }
    
About

Avatar for countxerox @countxerox started