You are reading a single comment by @Mrbbp and its replies.
Click here to read the full conversation.
-
Cannot cancel a locked stream
this is the error from the browser... sorry ;)
the page is connected to espruino
on the espruino:const onInit = () => { var step = 0; require("Encoder").connect(A8,A5, (dir) => { step += dir; print(step); if (dir > 0) { //allume la led 20ms digitalPulse(LED1, 1, 20); } else { digitalPulse(LED2, 1, 20); } }); };
i suppose the port is in use and therfor browser can not cancel connection...
thanks for your time.
é.
I'm not sure about
Cannot cancel a locked stream
- I haven't come across that one before :(If you want to use the command-line and not the browser (eg Node.js) then there's https://serialport.io/ - not quite the same API but it's a very similar idea.
But from the Web Browser itself, for security they say that you have to bring up the port chooser at least once (but there's no need for the BT/USB menu).
UART.js is based on Web Serial, so you could use that directly and you'd have a lot more flexibility (and avoid having the menu) - check out https://codelabs.developers.google.com/codelabs/web-serial/#3