UNPKG

camera-serial-utils

Version:

A utility package for camera capture and serial communication using Web Serial API

28 lines (19 loc) 740 B
# bys相机串口文件 ## 使用方法 ### 安装命令 npm install camera-serial-utils ### 引入 import { captureCamera, serialHelper } from 'camera-serial-utils'; ### 方法使用 相机: //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();