Who can help me with the following code
I use a microphone, arduino uno, and a servo
Now it is the intention to make the servo of the microphone according to the input movement
In other words, the louder the input, the higher the output, or if you speak a rash into the microphone etc. servos the direction of the voice
a sort Wave Meter as this http://www.instructables.com/id/Wavebot/
I found a code that fits what I want
Normally should be replaced in the bottom line 300 by 1023 but it does not work right, does anyone know the reason
val = map (fall, 0, 300, 0, 179);
Also you must speak fairly loudly, how come it
I am using a MAX4466 electret microphone amplifier B0B # 5646, an Arduino Uno and SG90 9G servos
#include <Servo.h>
Servo myservo;
int val;
int SoundInPin = A0;
void setup()
{
myservo.attach(9);
pinMode(SoundInPin, INPUT);
}
void loop()
{
int sensorValue = analogRead(SoundInPin);
val = analogRead(0);
val = map(val, 0, 300, 0, 179);
myservo.write(val);
delay(15);
}
The project you added as reference uses an external FFT using processing that send the “translated” waveform to the arduino which only move the servo in this case.
However, for your case we suggest using the arduino FFT library for getting better results, you can also explore the “Beat Detection On The Arduino” that will get you closer for your need.