code help
Special_K
Posts: 162
I have this little bit of code that swings the Parallax Ping))) sonar to several positions using the servo in the Ping))) mounting kit. The sonar distance is logged in centimeters for each of the 5 positions and is displayed in the debug console. If I get the cm value as part of the main program it displays fine, however if I get the cm value as part of the subroutine all the values are the same as the first reading. I need some help.
Also I was wondering if any one had a link to documentation about the select case statement. I have the Boe-Bot manual and I just need a little more in depth explanation. I·am looking·to use the case statement to get the longest distance.
Also I was wondering if any one had a link to documentation about the select case statement. I have the Boe-Bot manual and I just need a little more in depth explanation. I·am looking·to use the case statement to get the longest distance.
Comments
http://www.parallax.com/dl/src/prod/RoamingWithPING-V1.0.bs2
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I took a look at that code but I am nout shure I can really use it since I am using Sharp GP2D02 IR Rangers. Or should I use that code as a base and not try to reinvent the wheel.
You did not mention this above...It is now unclear to me exactly what you are using.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
·
I have broken the project into smaller sections. The first is a right and left sweep with the Ping))) and logging the longest distance. The problem I am having is that the distances in the debug window are all the same as the first reading that the Ping))) takes.
I am using the debug display to see the distances and I only see the same number displayed for distances of 5 direction when I know they are different.
pos1 with all the debugs.
fixed that and I am getting the right values.
Now on to the distance checks any thoughts. I really do not want to use a lot of IF..THEN statements