2.0.2 • Published 18 days ago
@iiot2k/mcp4725 v2.0.2
@iiot2k/mcp4725
mcp4725 digital to analog converter library
Installation
npm install @iiot2k/mcp4725
or add in your package.json
:
"dependencies": {
"@iiot2k/mcp4725": "latest"
},
mcp4725 12bit digital to analog converter
- 12bit Conversion Resolution.
- One Analog Output.
- External Voltage Reference.
- Power Down of output with terminating resistor.
- Store output to internal eeprom.
Usage
- This library works on Raspberry Pi with 32bit or 64bit OS.
- Enable I2C with raspi-config.
- In this case i2c-1 is enabled (port=1).
- If you use i2c-0 port add dtparam=i2c_vc=on to /boot/config.txt, then Pin27=SDA, Pin28=SCK.
- For other ports add this to /boot/config.txt.
API
API functions are explained in documents API.md
Report any issues here
Example
// example writes to dac output
"use strict";
const mcp4725 = require("@iiot2k/mcp4725");
var ret = mcp4725.write_sync(
1, // i2c-1
mcp4725.ADR_60, // i2c address 0x60
1000 // dac value
);
if (ret === undefined)
console.log("error on write dac");
else
console.log(ret);
Examples are on examples folder.