MistyGro API
C++ API for MistyGro's ESP32 controller based on the Arduino framework
Public Member Functions | List of all members
ADC Class Reference

#include <adc.h>

Public Member Functions

 ADC ()
 
void begin (int addr, int sda_pin, int scl_pin)
 
int16_t read (ADCChannel ch)
 Read ADC value from channel. More...
 
float read_voltage (ADCChannel ch)
 Read voltage from ADC channel (computes voltage using the set fixed gain) More...
 

Detailed Description

Definition at line 27 of file adc.h.

Constructor & Destructor Documentation

◆ ADC()

ADC::ADC ( )
explicit

Definition at line 19 of file adc.cpp.

Member Function Documentation

◆ begin()

void ADC::begin ( int  addr,
int  sda_pin,
int  scl_pin 
)

initialise i2c, ADS1115 and set gain to 2/3

Parameters
addrADS i2c address
sda_pin
scl_pin

Definition at line 21 of file adc.cpp.

◆ read()

int16_t ADC::read ( ADCChannel  ch)

Read ADC value from channel.

Parameters
chADC channel of ADS1115
Returns
int16_t : adc value

Definition at line 34 of file adc.cpp.

◆ read_voltage()

float ADC::read_voltage ( ADCChannel  ch)

Read voltage from ADC channel (computes voltage using the set fixed gain)

Parameters
chADC channel
Returns
float : voltage

Definition at line 39 of file adc.cpp.


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