You are reading a single comment by @user125091 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 https://www.espruino.com/ws#websocket-se­rver)

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

    This dirty example helps, but not nice

      setInterval(function(){
          var cc = clients.map(ws => {
            ws.send('....');
            return ws.clone();
          } );
          clients =cc;
        
      },5000);
    
About

Avatar for user125091 @user125091 started