Digital to Analog Converter (DAC)
Overview
Digital-to-Analog Converter (DAC) library. Can only be used if the hardware has DAC pins.

Supported GPIO
- MCP2221
Commands
[INIT]
Enters initial configuration settings.
Item | Type | Description |
---|---|---|
DAC Pin | WRITE | Select the DAC output pin. |
[WRITE_VALUE]
Writes the value to output to the DAC.
Item | Type | Description |
---|---|---|
Output Value * | WRITE | The value to be converted to output voltage. |
* The output resolution and voltage vary depending on the hardware. Please refer to the specifications of each hardware.
Example (MCP2221)
Objective
Connect the ADC and DAC of MCP2221 to each other, convert the DAC output back through the ADC, and display it on dashboard widgets. The ADC resolution of MCP2221 is 10-bit (0~1023), and the DAC resolution is 5-bit (0~31).
Parts
Part | Quantity |
---|---|
MCP2221 | 1 |
Wiring
Connect the following pins horizontally to each other.
GPIO | GPIO |
---|---|
G1 (ADC1) | G2 (DAC) |

Project Link