Audio controlled motor?

Is it possible to use the velocity detected by a break out board to effect the speed of a motor spinning? I understand how an LDR does this but I'm not sure how a microphone could do it from it's analog output.

Would it be a case of assigning high to low motor responses to the numbers from the serial monitor of the BOB?

Marvinfly: Is it possible to use the velocity detected by a break out board to effect the speed of a motor spinning? I understand how an LDR does this but I'm not sure how a microphone could do it from it's analog output.

Would it be a case of assigning high to low motor responses to the numbers from the serial monitor of the BOB?

The term 'break-out board" is a generic term for a circuit board that allows surface-mount components to be connected easily. If you are using some kind of break-out board it is important to know what component or components are on the board. The first part of your question asks about 'velocity' detected and later you talk about audio and microphones. What break-out board are you using?

It's the BOB-09964 for detecting audio.

Velocity was the wrong word. Sorry I'm quite tired.

The first step is to connect the sparkfun "Breakout Board for Electret Microphone" sku: BOB-09964 to an analog input of the Arduino. The value is going to change thousands of times per second so that's way too fast for motor control. To measure volume/amplitude you could keep a running average of the differences between consecutive samples. High volume/amplitude noises will produce a higher running average.

int samples[100];
int index = 0;
long int sum;

void loop()
    {
    static int lastSample;
    int newSample = analogRead(0);  // Read pin 0
    sum -= samples[index];  // Remove oldest sample from running average
    samples[index] = lastSample - newSample; // Store most recent sample
    sum += samples[index];  // Add to running average
    lastSample = newSample;
    index = (index + 1) % 100;

    int amplitude = sum / 100;  //  Calculate running average.

    // Now set the motor speed based on sound amplitude
    }

Thanks, I'm still quite confused as I'm very new to this. I was running the following code. It's really jumpy. Any idea why?

const int dcPin = 13;
const int micInput = A0;

int micValue = 0;
int dcValue = 0;

void setup(){
 Serial.begin(9600); 
}  

void loop(){
 micValue = analogRead(micInput);
dcValue = map(micValue, 0, 1023, 0, 255);
analogWrite(dcPin, dcValue);


 Serial.print("sensor = " );                       
  Serial.print(micValue);      
  Serial.print("\t output = ");      
  Serial.println(dcValue); 
}