removal
This commit is contained in:
19
web/bru.html
19
web/bru.html
@@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
|
|
||||||
<!-- either local copy: -->
|
|
||||||
<script src="js-ts/webseriallib.js"></script>
|
|
||||||
<!-- or from a CDN online: -->
|
|
||||||
<!-- <script src="https://unpkg.com/@gohai/p5.webserial@^1/libraries/p5.webserial.js"></script> -->
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="css.css">
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
</main>
|
|
||||||
<script src="js-ts/serialv2.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -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();
|
|
||||||
}
|
|
@@ -1,6 +1,6 @@
|
|||||||
let port;
|
let port;
|
||||||
|
|
||||||
async function bwa() {
|
async function start() {
|
||||||
port = createSerial();
|
port = createSerial();
|
||||||
port.open(9600);
|
port.open(9600);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user