
tevans
Brazil
Asked
— Edited

friends, I've been trying to use the SoundServo control to animate the mouth in one of my robots.
I'm using the EZ-b4 soundservo.
but.. it does not respond in sync to the sayezb command...
sometimes it does not move at all.
someone knows how to set it up correctly in order to sync sound and the servo movement ?
thaks...
I mean, when using sayEZB it does not send the sound value to the soundservo ? instead the sound must be "listen"by the MIc ?!
It does not sync at all!
*stress*
I tryed to write one.. But I'm not the script guy yet...
4 positions (close, barely close, barely open, open) I think would work..
What do you think? *confused* *confused* *confused* *confused*
Code:
Obviously modify to suit and be aware this was written without ARC and without much thought. There may be a better method but the basics are there for you.
The IF nest checks the IFs in order so in the above we have
Code:
When the IF nest finds a statement which is true it will run the code after that statement but before the next. Once it has found a statement to be true and run the code after that statement it then jumps down to the EndIf.
The formatting of an IF nest helps explain it and helps write scripts.
So for instance, if the sound value variable was 7 I will explain the steps which will be run by ARC...
Code with line numbers and comments and settings removed to make it clearer and easier;
Code:
So taking $SoundValue as being 7 the script would run the following lines in this order...
01, 02, 04, 06, 07, 10, 11, 12, 01, 02 etc...
Notice that when the IF or ElseIf isn't true it doesn't run the code between the IF or ElseIf, it jumps to the next ElseIf or Else.
When it is true it runs the code after it (line 07) then jumps to the EndIf since a statement has been satisfied.
The order in which the If and ElseIfs are put makes a big difference.
So another example, this time $SoundValue is 0 the script would run the following lines in this order...
01, 02, 03, 10, 11, 12, 01, 02 etc.
If $SoundValue was 4 he script would run the following lines in this order...
01, 02, 04, 05, 10, 11, 12, 01, 02 etc.
If the $SoundValue was 11 the script would run the following lines in this order...
01, 02, 04, 06, 08, 09, 10, 11, 12, 01, 02 etc.
So once a statement is found to be true it stops checking the other statements hence the command being ElseIf.
Think about it this way, you see a colour on a piece of paper, someone asks you what colour it is out of Black, Blue or Red...
Code:
If it was black you wouldn't keep thinking about if it was blue or red, neither does an IF nest.
Hopefully that's explained it clearly.
The servo does not respond in sync to the sound.
When I power the EZB with 7.5 volts and plug the servo on (say.. D0) I always get the message "battery is low.."
I tried do feed the servo from another source.. but it simply do no move at all!
I am sooo frustrated.. The soundServo was a big thing to me to wait for the V4...
Thanks for ANY HELP!
Depending on the battery type and the voltage level you may need to replace the battery.
Check the voltage with a multimeter or connect it with no accessories connected to the EZ-B. Check the voltage then. It could be a faulty servo which, when attempting to move, creates a huge voltage drop, this may happen for many reasons so it's worth testing the servo and testing the battery.
Id say give the ez-b a try on a different PC or a different wifi dongle just to test it.
So what I did was incorporate an "audioservocontroller" board... (http://www.audioservocontroller.com/)
And that works great, even if getting sound from EZ-4 (I soldered the wires from the points indicated on the board to get the sound from ezb to audiocontroller...)
Of course it was not the best solution I was looking for (since if we could use only the EZ-B would be much better..)
So.. Any other Ideas ?!
thanks
But I can think a dozen of uses to sound servo feature, so I hope it works better in the future.
Thank you guys for your replies.
You rock!