Adafruit PCF8591 ADC + DAC Library
Public Member Functions | List of all members
Adafruit_PCF8591 Class Reference

#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)
 

Detailed Description

Driver for the Adafruit PCF8591 Combo ADC + DAC

Member Function Documentation

◆ begin()

bool Adafruit_PCF8591::begin ( uint8_t  i2caddr = PCF8591_DEFAULT_ADDR,
TwoWire *  theWire = &Wire 
)

Initialises the I2C bus, and finds the PCF8591 on the bus

Parameters
i2caddrThe I2C address to use for the sensor.
*theWireOptional wire interface, defaults to &Wire
Returns
True if initialisation was successful, otherwise False.

◆ enableDAC()

void Adafruit_PCF8591::enableDAC ( bool  enable)

Enables the DAC output or sets it to tri-state / high-Z

Parameters
enableFlag for desired DAC state

◆ analogRead()

uint8_t Adafruit_PCF8591::analogRead ( uint8_t  adcnum)

Read an analog value from one of the four ADC inputs

Parameters
adcnumThe single-ended ADC to read from, 0 thru 3
Returns
The value read: 0 is GND and 255 is VCC

◆ analogWrite()

void Adafruit_PCF8591::analogWrite ( uint8_t  output)

Writes a uint8_t value to the DAC output

Parameters
outputThe value to write: 0 is GND and 255 is VCC

The documentation for this class was generated from the following files: