You are reading a single comment by @Robin and its replies. Click here to read the full conversation.
  • Sun 2021.02.21

    re post #3 'Has the code in that section been used verbatim and what were those results?'
    re post #4 'i only use code from example'

    L3 of the first code block in post #1 does not match the three sections below heading 'Multiple sensors' as the 'sensors' array definition is missing.

    My inquiry was to see what errors occurred when using those three code blocks. ( me thinks none )

    To prove this to yourself, add a console.log( "Line 6: " + sensors ); (modify to your choosing) statement at L6 of the first code block to determine if your eight sensors are recognized.

    re: 'I do not know enithing' (sic)

    May I ask how many years of Javascript & coding experience you have so that we may provide other tutorials to assist.

  • I'em frontend developer, and I know JS pretty well.

    everything works, the sensors are detected. The problem is that in one example ASSERT is an error, in the second one runs out of memory.
    you don't even need to look at my code, the same problem will be copying the example from the espuino website

    ASSERT(jsvGetLocks(var) < 15) FAILED AT src/jsvar.c:721

    this error also occurs if you call the ws.send("....") 15 times (by­rver)

    var server = require('ws').createServer(onPageRequest­);
    var clients = [];
    server.on("websocket", function(ws) {
        ws.on('message',function(msg) { print("[WS] "+JSON.stringify(msg)); });
        ws.send("Hello from Espruino!");
        clients.forEach(ws => ws.send('....'));
    //after 14 events ERROR ASSERT(jsvGetLocks(var) < 15) FAILED AT src/jsvar.c:721 

    This dirty example helps, but not nice

          var cc = => {
            return ws.clone();
          } );
          clients =cc;

Avatar for Robin @Robin started