MCP4725

Build Status MIT license

Swift Swift Swift

SwiftPM

Raspbian

一个使用 SingleBoard 通过 I2C 驱动 MCP4725 DAC 的 Swift 驱动程序。

入门指南

使用此驱动并配置为 0-10V 的预制电路板可以从 Aptinex 和 ncd.io 找到。Adafruit 提供了一个配置为 0-5V 的分线板。

一个简单的例子如下:

// Most prototype boards have the default address as 0x62
// you can override this with an address parameter.
let mcp4725 = MCP4725(i2cBus: SingleBoard.raspberryPi.i2cMainBus)

// Voltages are the lower 12-bits of a 16-bit value. The top 4 bits are ignored.
// This writes a default setting into the EEPROM of the chip.
mcp4725.setDefault(voltage: 0, mode: .normal)

// Sets the voltage to maximum (5V)
mcp4725.set(voltage: 4095)

构建于

贡献

请阅读 CONTRIBUTING.md 以了解我们的行为准则,以及向我们提交 pull request 的流程。

作者

另请参阅参与此项目的 贡献者 列表。

许可

此项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件