My partner has convinced me to build an animatronic parrot head (the one on Mary Poppins umbrella) to compare a theatrical performance at the Mary Poppins Festival she coordinates here in Australia.
I have built the parrot head, got the eyes moving left and right as needed, the beak opens and closes when the Voice actor holds down a button and all is good.
What i am thinking of doing is placing a sound sensor for each ear, and then testing the difference in volume between each to determine the direction to the source, and use this to drive a servo to turn the head to face the sound. Then after a period of time return to face forward.
I will probably use a seperate servo so as not to inhibit speech and eye movement.
What I am looking for is suggestions / code snippets to help me get my head around the comparison of two inputs.
I think something like
If the level of left ear minus level of right ear is less than zero then turn head left Else if the level of left ear minus level of right ear is greater than zero then turn head right Else if the level of left ear minus level of right ear equals zero then Return to home End If
Any comment suggestion or code snippet appreciated.