Adafruit PCF8591 ADC + DAC Library
|
#include <Adafruit_PCF8591.h>
Public Member Functions | |
Adafruit_PCF8591 (void) | |
PCF8591 constructor. | |
bool | begin (uint8_t i2caddr=PCF8591_DEFAULT_ADDR, TwoWire *theWire=&Wire) |
void | enableDAC (bool enable) |
uint8_t | analogRead (uint8_t adcnum) |
void | analogWrite (uint8_t output) |
Driver for the Adafruit PCF8591 Combo ADC + DAC
bool Adafruit_PCF8591::begin | ( | uint8_t | i2caddr = PCF8591_DEFAULT_ADDR , |
TwoWire * | theWire = &Wire |
||
) |
Initialises the I2C bus, and finds the PCF8591 on the bus
i2caddr | The I2C address to use for the sensor. |
*theWire | Optional wire interface, defaults to &Wire |
void Adafruit_PCF8591::enableDAC | ( | bool | enable | ) |
Enables the DAC output or sets it to tri-state / high-Z
enable | Flag for desired DAC state |
uint8_t Adafruit_PCF8591::analogRead | ( | uint8_t | adcnum | ) |
Read an analog value from one of the four ADC inputs
adcnum | The single-ended ADC to read from, 0 thru 3 |
void Adafruit_PCF8591::analogWrite | ( | uint8_t | output | ) |
Writes a uint8_t value to the DAC output
output | The value to write: 0 is GND and 255 is VCC |