You are reading a single comment by @Saurabh and its replies. Click here to read the full conversation.
  • Hi All,

    i am transmitting BME680 data to my server using websocket . To doing this i am using espruino 1v99.
    I am facing issue of low memory every time and unable to write bme680 module code into esp32.
    All this things is working fine in espruino 1v96. but i cant use lower version because i have to use BLE feature too.

    My code :

    //reset();
    //E.setBootCode();
    //ws.send("hello world");
    //I2C1.setup({scl:22,sda:23});

    var wifi = require("Wifi");

    E.on('init',function() {
    var i2c = new I2C();
    i2c.setup({sda:32,scl:33});

    var bme = require("BME680").connectI2C(i2c, {addr:0x77});
    var wifi = require('Wifi');

    wifi.connect("saurabh.verma", {password:"test1234"}, function(err){

    var host = "154.0.82.179";
    var WebSocket = require("ws");
    var ws = new WebSocket(host,{
      path: '/',
      port: 8080, // default is 80
      protocol : "echo-protocol", // websocket protocol name (default is none)
      protocolVersion: 13, // websocket protocol version, default is 13
      origin: 'Espruino',
      keepAlive: 60,
      headers:{ some:'header', 'ultimate-question':42 } // websocket headers to be used e.g. for auth (default is none)
    });
    
    ws.on('open', function() {
      console.log("Connected to server");
    });
    setInterval(function() {
          var data = bme.get_sensor_data();
          var sensor = {};
          sensor.AQI = data;
          ws.send(JSON.stringify(sensor,null,2));
          bme.set_sensor_mode(1);
       }, 100);
    

    });
    });
    save();

    Output :

    New interpreter error: LOW_MEMORY,MEMORY

    =undefined
    WARNING: --- gap_setScan 0
    WARNING: Scan stop failed
    WARNING: set rssi scan not implemeted yet
    WARNING: has central connection not implemented yet
    Compacting Flash...
    Calculating Size...
    Writing..
    Compressed 40000 bytes to 14608
    Uncaught Error: Function "connectI2C" not found!
    at line 5 col 31
    var bme = require("BME680").connectI2C(i2c, {addr:0x77});

    When i check a memory
    1v99
    { "free": 2471, "usage": 29, "total": 2500, "history": 0,
    "gc": 0, "gctime": 1.799 }

    its half of previous

About

Avatar for Saurabh @Saurabh started