From f2e51dee8114cd923ec8fc15d3cf264de2b1e3d3 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Oct 2023 12:05:22 +0200 Subject: [PATCH] removal --- web/bru.html | 19 ----------------- web/js-ts/serial.js | 29 -------------------------- web/js-ts/serial.ts | 47 ------------------------------------------- web/js-ts/serialv2.js | 2 +- 4 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 web/bru.html delete mode 100644 web/js-ts/serial.js delete mode 100644 web/js-ts/serial.ts diff --git a/web/bru.html b/web/bru.html deleted file mode 100644 index 04e08d9..0000000 --- a/web/bru.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - -
-
- - - \ No newline at end of file diff --git a/web/js-ts/serial.js b/web/js-ts/serial.js deleted file mode 100644 index c5c12c6..0000000 --- a/web/js-ts/serial.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -async function connect() { - const port = await navigator.serial.requestPort(); - // - Wait for the port to open. - await port.open({ baudRate: 9600 }); - let decoder = new TextDecoderStream(); - const inputDone = port.readable.pipeTo(decoder.writable); - const inputStream = decoder.readable; - reader = inputStream.getReader(); - await readLoop(); -} -async function clickConnect() { - // CODELAB: Add connect code here. - await connect(); -} -async function readLoop() { - // CODELAB: Add read loop here. - while (true) { - const { value, done } = await reader.read(); - if (value) { - log.textContent += value + '\n'; - } - if (done) { - console.log('[readLoop] DONE', done); - reader.releaseLock(); - break; - } - } -} diff --git a/web/js-ts/serial.ts b/web/js-ts/serial.ts deleted file mode 100644 index e309467..0000000 --- a/web/js-ts/serial.ts +++ /dev/null @@ -1,47 +0,0 @@ -async function connect(){ - -const port = await navigator.serial.requestPort(); -// - Wait for the port to open. -await port.open({ baudRate: 9600 }); - -let decoder = new TextDecoderStream(); -const inputDone = port.readable.pipeTo(decoder.writable); -const inputStream = decoder.readable; -let reader = inputStream.getReader(); -const encoder = new TextEncoderStream(); -const outputDone = encoder.readable.pipeTo(port.writable); -const outputStream = encoder.writable; -await readLoop(); - -} - -async function clickConnect(){ -// CODELAB: Add connect code here. -await connect(); -} - -async function readLoop(){ - // CODELAB: Add read loop here. -while (true) { - const { value, done } = await reader.read(); - if (value) { - log.textContent += value + '\n'; - } - if (done) { - console.log('[readLoop] DONE', done); - reader.releaseLock(); - break; - } - } -} - -await function writeToStream(){ - - // CODELAB: Write to output stream -const writer = outputStream.getWriter(); -lines.forEach((line) => { - console.log('[SEND]', line); - writer.write(line + '\n'); -}); -writer.releaseLock(); -} \ No newline at end of file diff --git a/web/js-ts/serialv2.js b/web/js-ts/serialv2.js index 440ee21..e7750f4 100644 --- a/web/js-ts/serialv2.js +++ b/web/js-ts/serialv2.js @@ -1,6 +1,6 @@ let port; -async function bwa() { +async function start() { port = createSerial(); port.open(9600);