camera-serial-utils
Version:
A utility package for camera capture and serial communication using Web Serial API
28 lines (19 loc) • 740 B
Markdown
相机:
//1.打开相机
const base64Image = await captureCamera();
console.log("图片base64:", base64Image);
脉诊仪:
// 1. 打开串口
await serialHelper.open();
// 2. 发送数据
await serialHelper.send();
// 3. 读取数据
const data = await serialHelper.read();
console.log("收到数据:", data);
// 4. 关闭串口
await serialHelper.close();