Controlling rc servo motors using midi, will this code work

Hi,

Can somebody point me in that direction? I have A Leonardo and a FS0403 analog micro servo motor, and using the DAW Logic Pro X. what would be the best way of going about that. I basically want to sweep the servo motor back and forth using midi. Thanks. Matt

will this code work if I can modify it by replacing the sensors for servo motors and can someone give me a little guidance on how to modify it to work with rc servo motors. Thanks, Matt

//This program reads up to 6 analog sensors / potentiometers ans converts the data to Midi-Controller messages
// define Switchpin:
#define switchPin 10
// define LED:
#define LEDpin 13

// Variables

// define variables for the controller data
int AnalogValue[6] = {0,0,0,0,0,0};

// define the “lastValue” variables
int lastAnalogValue[6] = {0,0,0,0,0,0};

// select the midi Controller Number for each input
int midiCCselect[6] = {1,2,3,4,5,6};

// select threshold for each analog input
int thresh[6] = {1,1,1,1,1,1};

// select number of desired analog inputs (max 6)
int input_no = 6;

void setup() {
// set the states of the I/O pins:
pinMode(switchPin, INPUT);
pinMode(LEDpin, OUTPUT);
// Set MIDI baud rate:
Serial.begin(31250);

}

// main program loop
void loop() {

for(int i=0;i<input_no;i++){

AnalogValue = (analogRead(i))/8; // read the value from the analog input and divide by 8 for range 0-127
// check if value is greater than defined threshold (good for resistive touchpads etc)
if ( AnalogValue >thresh ) {
// check if analog input has changed
if ( AnalogValue != lastAnalogValue ) {

//send control change on cc#i
midiCC(0xB0, midiCCselect, AnalogValue);
// update lastAnalogValue variable
lastAnalogValue = AnalogValue;

//End if
}
//End if
}

//End for
}

//End Loop
}

// This function sends a Midi CC.
void midiCC(char CC_data, char c_num, char c_val){
Serial.print(CC_data, BYTE);
Serial.print(c_num, BYTE);
Serial.print(c_val, BYTE);

}