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;
}
});
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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
regards
é.