Ping Sensor
Tru Custom
Posts: 13
Hi All,
I am working with the BOE and Ping sensor, I am trying to get the piezo speaker to respond to a minimal distance detected.
The attached program works fine and displays in the DEBUG screen. I commented out my attempt to use an IF-THEN statement.
I am working as a student instructor for robot camp and we are developing some final projects that supports various disabilities.
The completed assembly will be attached to a cane and will respond to objects using a FREQOUT syntax. Once it is working, the goal becomes to vary the frequency based on the distance so the individual can navigate safely around obstacles.
Any help would be most appreciated.
Best regards, Tru
I am working with the BOE and Ping sensor, I am trying to get the piezo speaker to respond to a minimal distance detected.
The attached program works fine and displays in the DEBUG screen. I commented out my attempt to use an IF-THEN statement.
I am working as a student instructor for robot camp and we are developing some final projects that supports various disabilities.
The completed assembly will be attached to a cane and will respond to objects using a FREQOUT syntax. Once it is working, the goal becomes to vary the frequency based on the distance so the individual can navigate safely around obstacles.
Any help would be most appreciated.
Best regards, Tru
Comments
Rather than using the distance as "x" you could modify the original equation (the one which figures out the distance) and have it compute a frequency from the pulse time instead of distance. You need a value for "scale". You may need to rearrange the equation a bit if you want the frequency to decrease as the range increases.
It would probably be simpler to use the distance in a second equation rather than modifying the original equation.
The integer math limitation of the BS2 may require the equation you come up with to be rearranged in order to reduce the effects of rounding errors.
What frequency range do you want to use? What rules to you want applied (i.e. are there limits you want placed on the frequency)?
Add a variable for "freq".
Then before the "LOOP" statement" add the following code.
I'm not sure if I have the syntax correct of not (I don't use Basic Stamps much) but hopefully if it's not right it will give you the general idea.
Edit: I had forgot to add the intercept to the equation.