mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-23 08:09:48 +00:00
28 lines
612 B
JavaScript
28 lines
612 B
JavaScript
|
const main = async () => {
|
||
|
const _rg = require('@ocoge/rgpio');
|
||
|
|
||
|
const _sfm = require('@ocoge/sfmv17');
|
||
|
|
||
|
const fs = require('node:fs')
|
||
|
|
||
|
const _sleep = sec =>
|
||
|
new Promise(r => setTimeout(r, sec * 1000));
|
||
|
|
||
|
|
||
|
await _rg.rgpio_sbc('192.168.0.202');
|
||
|
await _sfm.init(_rg, '/dev/ttyS0', 115200);
|
||
|
await _sleep(0.1);
|
||
|
let r = await _sfm.getImage();
|
||
|
console.log(r);
|
||
|
console.log(r.length)
|
||
|
fs.writeFile("fptest.bmp", r, (err) => {
|
||
|
if (err) throw err;
|
||
|
console.log('正常に書き込みが完了しました');
|
||
|
});
|
||
|
|
||
|
await _sleep(0.1);
|
||
|
await _sfm.stop();
|
||
|
await _rg.sbc_stop();
|
||
|
|
||
|
}
|
||
|
main();
|