Using PING)), IR, Sound Impact and Whiskers on Boe-Bot


I am working on a project that is due in a couple of weeks. I have not been able to program my robot using any other sensors other than the PING)).
I am trying to make a robot that follows sound and color, spins when it is touched by whiskers and looks for where it goes as well as escape corners.

I have got it to function with PING)) by rotating when encountering obstacles. However, I tried programming whiskers in by using a while loop but, an error occurred. I have not attempted t program with Sound Impact and IR sensors.

Any advice? ASAP would help me.


  • 3 Comments sorted by Date Added Votes
  • Mike GreenMike Green Posts: 22,577
    edited October 21 Vote Up1Vote Down
    It's always hard to advise anyone on errors without the actual code posted. Either include it as an attachment or cut and paste between [ code] and [ /code] brackets (without the extra space).

    First get different programs working ... one using PING))), one using IR, one using whiskers, one using sound impact. You may not be able to combine all of these and still get any kind of effective speed of reaction. PING))) takes a lot of time. IR is pretty fast. Whisker sensing is instantaneous. Sound impact timing depends on what you're doing with it. Think about (specifically) you want your robot to do with IR sensing or sound impact sensing. Try adding whisker sensing to a PING))) program first ... not using a while, but IF-THEN statements.
  • Thank you very much. I have attempted this but, my program is quite weird. I have tried adding Ping and Whiskers as you mentioned. I attached the code as follows. Green
  • Unfortunately you've run across a fundamental limitation of the Basic Stamps ... they can only do one thing at a time. When your program does a PAUSE or PULSIN or PULSOUT, it stops doing anything else for the specified time (or for PULSIN until the pulse finishes). Servos require control pulses about every 20ms. If they occur less often, the servo shuts down. Other statements also take time ... typically a couple of hundred microseconds. It doesn't take too many GOSUBs and RETURNs before they eat up a few milliseconds. There's a demo program called Roaming with PING that demonstrates how to combine the use of a PING servo with distance sensing using the PING plus movements based on what's sensed. If you calculate the execution time along each of the program's paths (through the program), you'll find that it's pretty close to the "magic" 20ms along several of the paths.

    Here's some useful information on Stamp Programming. Look particularly at the tables of statement execution time. Add comments to each statement with the execution time for the statement. Then you can trace through the program in your head and mark down the range of times for subroutines and major sections of your code.

    The best you may be able to do is to stop, scan the environment with the PING and note distance sensed straight ahead and a little to the right and to the left. Your program can decide which way to turn, do so, then move straight ahead while checking the whiskers. If one of the whiskers is on, have your robot back up, then start again with the PING sensing.

    Notice that only one of the following is done at a time: the wheels turn right or left, the wheels back up, the wheels go forward with whisker sensing, the PING moves, the PING senses.
Sign In or Register to comment.