← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ae16c11d1c362732d298854f7be8290ca8309faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# `EZADC`

This ESP32 component was made to more easily gather data from the analog-to-digital converter (ADC). It defines a new data structure, `ADC`, which allows the user to quickly configure and use the ADC.

## `ADC`

To initialize the data structure, one may use the component library as follows:

	// Create ADC
	ADC my_adc;
	
	// Initialize ADC
	init_adc(&my_adc);
	
	// Configure ADC to channel 7
	config_adc(&my_adc, 7);
	
	// Read from ADC channel 7
	ez_read(&my_adc);
	
	// Tear down ADC when you're done
	teardown_adc(&my_adc);

This was originally done to read the battery voltage on the Adafruit Feather HUZZAH32, where the GPIO 35 is connected to ADC channel 7.