Skip to content

Commit 6a91734

Browse files
committed
UNO R4 Minima article too
1 parent f93e4bc commit 6a91734

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
Loading
Loading

content/hardware/02.hero/boards/uno-r4-minima/tutorials/dac/dac.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ Once you have uploaded the code to the board, it should start generating a sine
6161

6262
Now try twisting the potentiometer, and listen to how the sound changes.
6363

64+
### Analog Wave Types
65+
66+
The sketch above generates what is known as a sine wave. It is called a sine wave because if you were to plot the voltage against time, you'd notice that the line looks just like a sine function.
67+
68+
![Sine Wave](./assets/sine.png)
69+
70+
There are other types of analog waves that will produce a distinctly different type of sound compared to a sine wave. The library we're using in this sketch also allows you to create sawtooth and square waves. These types of wave also gets their names from how they look when the voltages are plotted against time.
71+
72+
![Square and Sawtooth Waves](./assets/sawandsquare.png)
73+
74+
Try changing the wave type and listen how it changes the feel of the sound.
75+
76+
Change the wave by replacing **Line 18 in the sketch** "`wave.sine(freq);`" with either
77+
78+
```arduino
79+
wave.square(freq);
80+
```
81+
or
82+
```arduino
83+
wave.saw(freq);
84+
```
85+
6486
Now that you know your setup is working, you can experiment further with different examples and see how you can use the DAC of the UNO R4 to generate sounds and even melodies.
6587

6688
***Note: In this setup, we're just using a piezo buzzer, you may notice that the sounds it's making are pretty faint. If you want to fix this you'll need a 4 or 8 Ohm speaker, and an amplifier. You can find many breakout amplifier modules that are easy to use online.***

0 commit comments

Comments
 (0)