Hi all. I found this interesting code for the arduino. Which sends your 0-5v CV into a midi cc. So you can use it in ableton… Or whatever you want!
To give credit: https://forum.aemodular.com/thread/141/simple-cv-midi-converter-arduino
// Set MIDI baud rate:
Serial.begin(31250);
// not sure if I need this:
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A5, INPUT_PULLUP);
}
const int cvInputs = 6; // how many analog inputs are used
int cvLevels[cvInputs] = {0, 0, 0, 0, 0, 0};
int analogInputs[cvInputs] = {A0, A1, A2, A3, A4, A5}; // analog inputs
int midiChannel = 0; // MIDI channels 0-15 are 1-16
int midiCCnumbers[cvInputs] = {10, 11, 12, 13, 14, 15}; // define CC# for each CV input
int midiCCvalues[cvInputs] = {0, 0, 0, 0, 0, 0};
void loop() {
for (int i = 0; i < cvInputs; i++)
{
cvLevels[i] = floor(analogRead(analogInputs[i])/8); // convert 10 bit analog input to 7 bit MIDI range
// if cv has changed, update cv input value and send new midi cc value
if (cvLevels[i] != midiCCvalues[i])
{
midiCCvalues[i] = cvLevels[i];
sendCC(midiChannel, midiCCnumbers[i], midiCCvalues[i]);
delay(50); // need to experiment with this delay some more, 50 is probably too long
}
}
}
void sendCC(uint8_t channel, uint8_t control, uint8_t value) {
Serial.write(0xB0 | (channel & 0xf));
Serial.write(control & 0x7f);
Serial.write(value & 0x7f);
}
I changed the code for the nano to this:
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
// not sure if I need this:
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A5, INPUT_PULLUP);
pinMode(A6, INPUT_PULLUP);
pinMode(A7, INPUT_PULLUP);
}
const int cvInputs = 8; // how many analog inputs are used
int cvLevels[cvInputs] = {0, 0, 0, 0, 0, 0, 0, 0};
int analogInputs[cvInputs] = {A0, A1, A2, A3, A4, A5, A6, A7}; // analog inputs
int midiChannel = 0; // MIDI channels 0-15 are 1-16
int midiCCnumbers[cvInputs] = {10, 11, 12, 13, 14, 15, 16, 17}; // define CC# for each CV input
int midiCCvalues[cvInputs] = {0, 0, 0, 0, 0, 0, 0, 0};
void loop() {
for (int i = 0; i < cvInputs; i++)
{
cvLevels[i] = floor(analogRead(analogInputs[i])/8); // convert 10 bit analog input to 7 bit MIDI range
// if cv has changed, update cv input value and send new midi cc value
if (cvLevels[i] != midiCCvalues[i])
{
midiCCvalues[i] = cvLevels[i];
sendCC(midiChannel, midiCCnumbers[i], midiCCvalues[i]);
delay(50); // need to experiment with this delay some more, 50 is probably too long
}
}
}
void sendCC(uint8_t channel, uint8_t control, uint8_t value) {
Serial.write(0xB0 | (channel & 0xf));
Serial.write(control & 0x7f);
Serial.write(value & 0x7f);
}
So why will this only work with the uno. I have almost no experience with coding or arduino’s…