import { SerialPort } from "serialport"; import fs from "fs"; import { SerialPortTransport } from "./transport/serialport"; import { STK500 } from "./flasher/stk500v1"; SerialPort.list().then(async (ports) => { const uno = ports.find( (port) => port.vendorId === "2341" && port.productId === "0043" ); console.log(uno); if (uno) { const port = new SerialPort({ path: uno.path, baudRate: 57600, autoOpen: false, }); const transport = new SerialPortTransport(port); const flasher = new STK500(transport); const hex = fs.readFileSync( "/Users/zoro/avrboy/src/hex/Blink.ino.standard.hex" ); flasher.flash(hex, { timeout: 400, verbose: true, }); } });