Removed delay

main
Mike Lynch 2024-10-26 18:17:04 +11:00
parent 534a6602a4
commit 136f6b389b
1 changed files with 0 additions and 41 deletions

View File

@ -1,41 +0,0 @@
// Basic demo for configuring the MCP4728 4-Channel 12-bit I2C DAC
#include <Adafruit_MCP4728.h>
#include <Wire.h>
Adafruit_MCP4728 mcp;
float xlog = 0.5;
float r = 3.783423;
void setup(void) {
Serial.begin(115200);
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit MCP4728 test!");
// Try to initialize!
if (!mcp.begin(0x64)) {
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() {
int pot = analogRead(A0);
r = (float)pot / 1024.0 + 3.0;
xlog = r * xlog * (1 - xlog);
int cv = round(xlog * 4095.0);
mcp.setChannelValue(MCP4728_CHANNEL_A, cv);
// delay(100);
}