Skip to content

Instantly share code, notes, and snippets.

View luciferms1990's full-sized avatar

luciferms1990

View GitHub Profile
@Wollw
Wollw / adc_example.c
Created April 16, 2012 06:00
ATmega328P ADC conversion example
/* A simple ADC example that checks the analog reading on ADC0 and turns
* an LED on if the reading is higher than a threshold value and turns if
* off if it is under that value. */
#include <avr/io.h>
#include <stdint.h>
/* Which analog pin we want to read from. The pins are labeled "ADC0"
* "ADC1" etc on the pinout in the data sheet. In this case ADC_PIN
* being 0 means we want to use ADC0. On the ATmega328P this is also
* the same as pin PC0 */