O'Reilly logo

Build Your Own Autonomous NERF Blaster : Programming Mayhem with Processing and Arduino by Bryce Bigger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8Blaster Brains and Eyes

Before we get too much farther in the build, let’s take a quick break to go through the blaster’s basic logic:

Find target → Move toward target → If target is dead ahead, fire blaster

Based on the components we’ve amassed, let’s use this logic to identify who or what is responsible for each step.

1. The webcam on top of the turret will send the video to Processing. This is how the target will be found.

2. Processing, via the OpenCV library (remember—a few chapters back?), looks for a target. When it finds one, it notes the target’s placement in relation to the center of the webcam video. If the target is to the right of center, we’ll need the blaster to move to the right. If it’s to the left, we’ll move left. So, based ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required