2wire 中文文档教程
2wire
轻松访问 I2C 设备。
它是为 Raspberry Pi(在 i2c_dev
内核模块之上)设计的,但也可以在不同的板上工作。
包括 TypeScript 定义。
Example
将 0x20 寻址的设备的寄存器 0x58 写入值 42。
const TwiDevice = require('2wire').TwiDevice;
const wire = new TwiDevice('/dev/i2c-1', 0x20);
wire.writeByte(0x58, 42);
2wire
Easy access to I2C devices.
It was designed for the Raspberry Pi (on top of the i2c_dev
kernel module), but may work on different boards, too.
TypeScript definitions are included.
Example
Write register 0x58 of device addressed by 0x20 to value 42.
const TwiDevice = require('2wire').TwiDevice;
const wire = new TwiDevice('/dev/i2c-1', 0x20);
wire.writeByte(0x58, 42);