Ableton > Arduino > servo

Hi all,
I'm an artist wanting to create a moving sculpture sychronised by midi/Ableton. I would like to use Ableton to control servos or solenoids. I found something close with littlescale but alas there is no code. (not allowed to add links but search "little scale arduino ableton servo") I'm not really a coder, so would really appreciate some help with this.

Has anyone else tried this out? How is it possible? I have a demo of Max/msp but again am still learning. Any help would be appreciated.

Here are the code from the Blog

/* Quick Serial Servo Control

A quick test with a servo motor. 
Serial data controls the position of a micro servo motor.

http://little-scale.blogspot.com/2008/02/arduino-serial-servo-control.html

by Sebastian Tomczak
3 February 2008

Adelaide, Australia

*/


byte data;

void setup() 
{
      Serial.begin(57600);
      pinMode(2, OUTPUT);      // output to servo
}

void loop() 
{
      if(Serial.available() > 0) 
      {
            data = Serial.read();
            for(int i = 0; i < 21; i++) 
            {
                  digitalWrite(2, HIGH);
                  delayMicroseconds(data * 6 + 700);
                  digitalWrite(2, LOW);
                  delayMicroseconds(22000 - (data * 6 + 700));
            }
      }
}

To run two servo motors and sequence them from Ableton Live...

/* Quick 2 x Serial Servo Control

And of course, by extension it is quite easy to modify the above code 
to run two servo motors and sequence them from Ableton Live...
by Sebastian Tomczak

used a software layer in the form of a Max/MSP patch which took MIDI data, 
formatted it, and sent it to the Arduino via a serial connection. 

but of course this could be done directly via MIDI as you suggest. 
you would have to write / find a MIDI input driver --- 
i have some code that i reuse time and time again, 
i can send it to you if you email me. 

seb dot tomczak at gmail dot com,

3 February 2008

Adelaide, Australia

*/
byte data1;
byte data2;

void setup() 
{
      Serial.begin(57600);
      pinMode(2, OUTPUT);            // output to servo
      pinMode(3, OUTPUT);
}


void loop() 
{

      if(Serial.available() > 1) 
      {
            data1 = Serial.read();
            data2 = Serial.read();
            for(int i = 0; i < 20; i++) 
            {
                  digitalWrite(data1, HIGH);
                  delayMicroseconds(data2 * 6 + 700);
                  digitalWrite(data1, LOW);
                  delayMicroseconds(22000 - (data2 * 6 + 700));
            }
      }
}

Which part of code you need help? for Midi processing follow this link and look for Midi

Hey BillHo,

Thanks for the reply. Although, am I missing something? Littlescale says "And of course, by extension it is quite easy to modify the above code
to run two servo motors and sequence them from Ableton Live..." but doesn't say HOW?
Again any help, much appreciated.

he goes on to say, "used a software layer in the form of a Max/MSP patch which took MIDI data,
formatted it, and sent it to the Arduino via a serial connection." Anyone done this? Have an example? Or could give tutorial of how to make such a thing in Max? That would be awesome!