while(digitalRead(soundPin) == LOW){
//keep the doppler effect mode activated
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
//get data
vib = abs(gz)/1000; //the gz variable is actually accelerator data
//this is calibrated though the division and simplified to use by absolute value
if(vibEnable == 1 && vib >= 2){
//though "blinking" the vibrato/doppler effect is simulated
//this activates only, when the calibrated acceleration value exceeds 1
myservo.write(vib*6 + 6); //outputs the digitally calculated value to the servo which feeds the analogue theremin circuit.
vibEnable = 0;
}else{
myservo.write(vib*6 - 6);
vibEnable = 1;
}
delay(20); // this is necessary, because the servo requires some time to move (about 60 degrees per second)
}
Could you share some code on the doppler effect simulations? Right now I'm only using tone() for that plus the mpu6050...