【发布时间】:2019-11-15 07:12:55
【问题描述】:
我已经尝试了很多教程,但我无法让它发挥作用。
现状:
- 12V Access control device 即 connected like this 即 Wiegand D0 到 GPIO14(引脚 8/Tx)和 D1 到 GPIO15(引脚 10/Rx),带有分压器,将 5V 转换为 3.3V。
- 带有 Raspbian Lite 操作系统的 Raspberry Pi 3。
- Configured the GPIO serial port 即启用 uart 并禁用控制台。
我正在使用onoff NPM package 读取信号,但我什么也没收到。
const Gpio = require('onoff').Gpio;
const d0 = new Gpio(8, 'in');
const d1 = new Gpio(10, 'in');
d0.watch((err, value) => {
if (err) {
throw err;
}
d0.readSync(value);
});
d1.watch((err, value) => {
if (err) {
throw err;
}
d1.readSync(value);
});
process.on('SIGINT', () => {
d0.unexport();
d1.unexport();
});
我做错了什么?
【问题讨论】:
标签: node.js raspberry-pi access-control wiegand