ATtiny85 Template Code
Code snippets for the ATtiny85
 All Files Functions Variables Typedefs Enumerations Enumerator Macros
analog.c File Reference
#include <avr/io.h>
#include "iohelp.h"
Include dependency graph for analog.c:

Go to the source code of this file.


void adcInit (ANALOG adc)
uint16_t adcRead (ANALOG adc, uint8_t skip, uint8_t average)

Function Documentation

void adcInit ( ANALOG  adc)

Initialise the specified analog pin

This function initialises the ADC accessory as well as setting up the input pin attached to the ADC. The set up uses VCC as the reference voltage. If you need to change this do so after initialising all the ADC inputs you want to use.

adcthe ADC input to initialise.

Definition at line 20 of file analog.c.

uint16_t adcRead ( ANALOG  adc,
uint8_t  skip,
uint8_t  average 

Read a value from the analog input

Read a 10 bit value from the specified input with option input skipping and averaging.

adcthe ADC input to read
skipthe number of samples to skip (read and ignore).
averagethe number of samples to average (must be >= 1)
the sample value.

Definition at line 61 of file analog.c.