09-15-2025, 01:39 AM
Code:
// Basic demo for configuring the MCP4728 4-Channel 12-bit I2C DAC
#include <Adafruit_MCP4728.h>
#include <Wire.h>
// I2C pin definitions
#define I2C_SDA 8
#define I2C_SCL 18
Adafruit_MCP4728 mcp;
void setup(void) {
Serial.begin(115200);
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit MCP4728 test!");
Wire.begin(I2C_SDA, I2C_SCL);
// Try to initialize!
if (!mcp.begin()) {
Serial.println("Failed to find MCP4728 chip");
while (1) {
delay(10);
}
}
mcp.setChannelValue(MCP4728_CHANNEL_A, 4095);
mcp.setChannelValue(MCP4728_CHANNEL_B, 2048);
mcp.setChannelValue(MCP4728_CHANNEL_C, 1024);
mcp.setChannelValue(MCP4728_CHANNEL_D, 0);
}
void loop() { delay(1000); }
12-DAC-MCP4728.zip (Size: 566 bytes / Downloads: 195)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
12-DAC-MCP4728.ino.merged.zip (Size: 198.76 KB / Downloads: 196)
YouTube: https://www.youtube.com/c/KinCony
Online Store: https://shop.kincony.com
Alibaba Store: https://kincony.en.alibaba.com/
Online Store: https://shop.kincony.com
Alibaba Store: https://kincony.en.alibaba.com/

