
Cameron
USA
Asked
— Edited
Hey Everyone!
I am currently stuck on how to code these 2 sound sensors (1 on left, 1 on the right)(picture below) on the head of my robot. I have a servo (D18) that goes up to 180 degrees and I want the head to turn towards the loudest noise level. I have looked at some examples and I still dont have any progress.
Any help would be appreciated
Thanks,
Cameron
@CochranRobotics
I adjusted the values a few times and it still goes to one side and not the other. Here is the script I am using:
I even tried the 2 put together you posted and it still did the same thing. I know I am missing something here just not seeing it...
Hi Cameron, I posted that script. Have you ran the script in the RUN window to see if you are getting the <-100 and/or >-100 values for each sensor, if so, are you? If not, perhaps there is something wrong with a sensor. Try switching the sensors around and see what happens
@bhouston
Yeah im sorry i meant to add you to the thread as well. I have ran the script multiple times and it does show 1 having a bigger value in the variable list. But at another time they are both over 100. I'll try again and even switch them like you said.
Thank you
Run it in this window and you can see exactly what the script and the sensors are doing as you run the script.
I see that you have - if($Direction>-100) - I think it should be >100.
What is the "*100" in the following part of the script:
Are you trying to comment out the 100 for your reference? Unless I was not aware of this being OK, I don't think you can use a * to comment out something. I've always used this character: #
it was to make the value obviously high.
I think he has a sensor that os messing up or reporting much lower than the other but that is just a guess.
So this * forces the ACD reading to a wanted value? I'm not understanding this. Sorry. Can't find this in the EZ Script manual. confused