Roaming with Ultrasound
Now that you can measure centimeter distances with the PING))) sensor, and know which kinds of objects it can sense, let’s put it to work in navigation.
Now that you can measure centimeter distances with the PING))) sensor, and know which kinds of objects it can sense, let’s put it to work in navigation.
Let's take a look at the code. You can adapt it to work with different sensors, and use your own WAV files to play different sounds.
The Arduino KittyBot project includes the following libraries. The three are standard Arduino Libraries. The fourth is a custom library for the Adafruit "Music Maker" MP3 Shield.
Now that you can measure centimeter distances with the PING))) sensor, and know which kinds of objects it can sense, let’s combine the sensor's input with the servo motor's output.
Our goal is for the ActivityBot to roam and avoid objects using sound with the PING))) sensor. In one way, this is an improvement over whisker-switch navigation, because the ActivityBot does not have to bump into objects to detect them.
Now that you can measure centimeter distances with the PING))) sensor, and know which kinds of objects it can sense, let’s combine the sensor's input with the servo motor's output.
Our goal is for the ActivityBot to roam and avoid objects using sound with the PING))) sensor. In one way, this is an improvement over whisker-switch navigation, because the ActivityBot does not have to bump into objects to detect them.
Congratulations! You've made it to the end of the book. Now that you've mastered the basics, you're ready to start exploring and adding capabilities with your BOE Shield-Bot! Here are some ideas:
Or, if you're interested in trying specific sensors or adapting projects from other platforms, take a look at some of the options below.
Need help parking in just the right spot to clear the garage door without tapping the front bumper? Use the PING))) Ultrasonic Distance Sensor to measure the distance to your car, with indicator lights to tell you when to stop. This little project uses the parts in the BlocklyProp Starter Kit.
Let's take a look at the code. You can adapt KittyBot to work with different sensors, and use your own WAV files to make different noises.
The KittyBot project includes the following 4 libraries (see below code).
If you're using the KittyBot program for the ActivityBot 360° Robot, its fourth library #include shown below will be abdrive360 not abdrive. Every other part of this program should look the same regardless of which ActivityBot you use.
Right now, you can drive your ActivityBot right into an obstacle. But, if you already have the Ping))) Ultrasonic Distance Sensor or the whisker switches on board, you can program your ActivityBot for a little self-preservation!
This house has an opening where the visitor can reach inside to grab a piece of candy on a small table. The candy is even lit up with an LED ring to make it tempting! But, a PING))) sensor detects the visitor’s hand, and a servo flips down a bunch of hidden pipe cleaners to tickle and scare the visitor. Plus, the candy is fully glued down so no there's treasure to claim here — except for the first secret passcode digit displayed on the 7-segment LED.