You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/02.hero/boards/uno-r4-wifi/tutorials/dac/dac.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -25,13 +25,6 @@ In this article, you will learn:
25
25
- how to generate a waveform (sawtooth),
26
26
- how to output this waveform on a piezo speaker.
27
27
28
-
### Analog Output VS. PWM
29
-
For many use cases when analog output is required, using PWM (Pulse Width Modulation) instead of genuine analog output will yield essentially the same results. A digital output pin can only either be fully on (HIGH) or fully off (LOW), but by turning on and off very quickly with precise timings, the average voltage can be controlled and emulate an analog output. This method is called [PWM](/learn/microcontrollers/analog-output).
30
-
31
-
For example when dimming an LED, you can freely use a PWM enabled digital pin as an analog output pin and the LED would dim just the same as if you'd be using a DAC output.
32
-
33
-
However this will not always be the case, and for many uses you will need to use a genuine analog output to get your desired results. One such case is in audio purposes, where a PWM output simply will not give the same quality of sound as a genuine analog output, and requires some fiddling to work in the first place.
34
-
35
28
## Hardware & Software Needed
36
29
To follow along with this article, you will need the following hardware:
37
30
@@ -45,6 +38,13 @@ The circuit required for this tutorial can be found in the diagram below:
45
38
46
39

47
40
41
+
## Analog Output VS. PWM
42
+
For many use cases when analog output is required, using PWM (Pulse Width Modulation) instead of genuine analog output will yield essentially the same results. A digital output pin can only either be fully on (HIGH) or fully off (LOW), but by turning on and off very quickly with precise timings, the average voltage can be controlled and emulate an analog output. This method is called [PWM](/learn/microcontrollers/analog-output).
43
+
44
+
For example when dimming an LED, you can freely use a PWM enabled digital pin as an analog output pin and the LED would dim just the same as if you'd be using a DAC output.
45
+
46
+
However this will not always be the case, and for many uses you will need to use a genuine analog output to get your desired results. One such case is in audio purposes, where a PWM output simply will not give the same quality of sound as a genuine analog output, and requires some fiddling to work in the first place.
47
+
48
48
## Code
49
49
The code for this tutorial is split in two part, one main sketch and a header file containing a pre-generated sawtooth-waveform.
0 commit comments