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

    i'm playing with the uart.js lib to connect an espruino to a webpage.
    Is it possible to connect to an espruino by command line (js) without the menu "bt4 or webserial", if i know the name of my espruino?
    and can i use connection.close() (line 3) to disconnect the espruino from the page (without closing the webpage)? (to update the code in the webIDE)

    i use this example

    let connection;
        if (connection) {
          connection.close();
          connection = undefined;
        }
        UART.connect((c) => {
          if (!c) {
            console.log("Pas de connexion");
            alert("Impossible de se connecter");
            return;
          }
          console.log("Connecté");
          connection = c;
          // Handle the data we get back, and call 'onLine'
          // whenever we get a line
          resultData = "";
          connection.on("data", (d) => {
            resultData = d;
            resultData  = resultData.replace(/\r\n|>|\[J/g, '');
            if (resultData.length > 1) {
              document.querySelector("article").innerHTML = resultData;
            }
          });
        });
    

    regards

    é.

About

Avatar for Mrbbp @Mrbbp started