The MCP4822 has 2 Volt outputs, i understand from the datasheet. I managed to use one, but i would like to use them both. I like this Arduino and chips to generate CV. Here is the code i use to generate one Volt out
define DATAOUT 11//MOSI - serial data input
define DATAIN 12//MISO - not used, but part of builtin SPI
define SPICLOCK 13//sck - serial clock input
define SLAVESELECT0 10//ss for 1st DAC - chip select input for 1st DAC
//#define SLAVESELECT1 9//ss for 2nd DAC - chip select input for 2nd DAC
include "Spi.h"
const int kGatePin = 2;
int potPin = 2; // select the input pin for the potentiometer int val = 0; // variable to store the value coming from the sensor
void sendNote(int key) { int pitch = 0xa00L * key / 12;
digitalWrite(SS_PIN, LOW); Spi.transfer(0x10 + (pitch >> 8)); Spi.transfer(pitch & 0xff); digitalWrite(SS_PIN, HIGH);
digitalWrite(kGatePin, HIGH); delay(val); digitalWrite(kGatePin, LOW); delay(10); }
void setup() { pinMode(kGatePin, OUTPUT); }
void loop() { val = analogRead(potPin); sendNote(0); sendNote(12); sendNote(11); sendNote(12); sendNote(16); sendNote(12); sendNote(11); sendNote(12);
}