| Supported Targets | ESP32 | ESP32-S2 |
|---|
DAC Cosine Wave Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)
Overview
This example shows the basic usage of outputting cosine wave by the DAC driver. The cosine wave is generated by the hardware cosine wave generator in the DAC module.
This example outputs cosine waves on both channels, with opposite phase and different amplitude.
How to use the Example
Hardware Required
- A development board with ESP32 or ESP32-S2 SoC
- DAC channel to GPIO mapping: see GPIO Summary (switch the chip target on the documentation page if needed)
- Note that some ESP32-S2 DevKits have an LED on the DAC1 pin, so that channel's output may not go fully low
- (Optional) An oscilloscope to monitor the output wave
Build and Flash
Build the project and flash it to the board, then run monitor tool to view serial output:
idf.py -p PORT flash monitor
(Replace PORT with the name of the serial port to use.)
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
Example Output
DAC cosine wave started
Connect an oscilloscope to the DAC GPIOs to observe two cosine waves with opposite phase and different amplitude at 8000 Hz.