Little-Wire
 All Classes Functions Groups Pages
ADC

Analog to digital converter functions. More...

Functions

void analog_init (littleWire *lwHandle, unsigned char voltageRef)
 
unsigned int analogRead (littleWire *lwHandle, unsigned char channel)
 

Detailed Description

Analog to digital converter functions.

Function Documentation

void analog_init ( littleWire *  lwHandle,
unsigned char  voltageRef 
)

Initialize the analog module. VREF_VCC is the standard voltage coming from the USB plug
Others are the Attiny's internal voltage references.

Parameters
lwHandlelittleWire device pointer
voltageRef(VREF_VCC , VREF_110mV or VREF_2560mV )
Returns
(none)

Definition at line 205 of file littleWire.c.

unsigned int analogRead ( littleWire *  lwHandle,
unsigned char  channel 
)

Read analog voltage. Analog voltage reading from ADC_PIN3 isn't advised (it is a bit noisy) but supported. Use it at your own risk.
For more about internal temperature sensor, look at the Attiny85 datasheet.

Parameters
lwHandlelittleWire device pointer
channelSource of ADC reading (ADC_PIN2 , ADC_PIN3 or ADC_TEMP_SENS )
Returns
10 bit ADC result

Definition at line 210 of file littleWire.c.