pcf8591
Thin I2C wrapper to access the PCF8591 8-bit A/D and D/A converter.
Install
$ npm install pcf8591
Usage
var PCF8591 = ; // Constructor: PCF8591(device, slaveAddress, controlByte),// defaults to: '/dev/i2c-1', 0x48, 0x00.var pcf8591 = ; // Reconfigure control register following the Datasheet.pcf8591; // Discard first reading after POR or read mode change.pcf8591;pcf8591; var output = 0x00;;
Raspberry Pi Setup
$ sudo nano /etc/modules
Add these two lines:
i2c-bcm2708 i2c-dev
$ sudo nano /etc/modprobe.d/raspi-blacklist.conf
Comment out the I2C module from the blacklist:
#blacklist i2c-bcm2708
To make the I2C device writable create a file:
sudo nano /etc/udev/rules.d/99-i2c.rules
and enter:
KERNEL=="i2c-1", MODE="1666"
Then load kernel module:
$ sudo modprobe i2c-bcm2708