Digital-to-Analog Converter (DAC)

Browse source code on GitHub

Overview

This sample demonstrates how to use the DAC driver API.

Building and Running

The DAC output is defined in the board’s devicetree and pinmux file.

The board’s /zephyr,user node must have dac, dac-channel-id, and dac-resolution properties set. See the predefined overlays in samples/drivers/dac/boards for examples.

Building and Running

The sample can be built and executed as follows:

west build -b <board-name> samples/drivers/dac
west flash

Sample output

You should see a sawtooth signal with an amplitude of the DAC reference voltage and a period of approx. 4 seconds at the DAC output pin specified by the board.

The following output is printed:

Generating sawtooth signal at DAC channel 1.

Note

If the DAC is not supported, the output will be an error message.

See also

DAC