Skip to content

Commit 2884215

Browse files
authored
Documentation for DAC peripheral (#6337)
1 parent a57cac6 commit 2884215

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Diff for: docs/source/api/dac.rst

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
###
2+
DAC
3+
###
4+
5+
About
6+
-----
7+
8+
DAC (digital to analog converter) is a very common peripheral used to convert a digital signal to an
9+
analog form.
10+
11+
ESP32 and ESP32-S2 have two 8-bit DAC channels. The DAC driver allows these channels to be set to arbitrary voltages.
12+
13+
DACs can be used for generating a specific (and dynamic) reference voltage for external sensors,
14+
controlling transistors, etc.
15+
16+
========= ========= =========
17+
ESP32 SoC DAC_1 pin DAC_2 pin
18+
========= ========= =========
19+
ESP32 GPIO 25 GPIO 26
20+
ESP32-S2 GPIO 17 GPIO 18
21+
========= ========= =========
22+
23+
Arduino-ESP32 DAC API
24+
---------------------
25+
26+
dacWrite
27+
********
28+
29+
This function is used to set the DAC value for a given pin/DAC channel.
30+
31+
.. code-block:: arduino
32+
33+
void dacWrite(uint8_t pin, uint8_t value);
34+
35+
* ``pin`` GPIO pin.
36+
* ``value`` to be set. Range is 0 - 255 (equals 0V - 3.3V).
37+
38+
dacDisable
39+
**********
40+
41+
This function is used to disable DAC output on a given pin/DAC channel.
42+
43+
.. code-block:: arduino
44+
45+
void dacDisable(uint8_t pin);
46+
47+
* ``pin`` GPIO pin.

0 commit comments

Comments
 (0)