O'Reilly logo

Electronics All-in-One For Dummies, UK Edition by Doug Lowe, Dickon Ross

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

Chapter 4

Adding Sound and Motion to Your BASIC Stamp Projects

In This Chapter

arrow Making noise with a piezo speaker

arrow Creating movement with a servo

Everyone enjoys being able to create a din from time to time (except perhaps Trappist monks), and so in this chapter we lead you through working with devices that add sound (as well as motion) to your BASIC Stamp projects.

To make some noise, you can add a piezo speaker to create audible output tones, something that’s useful when your BASIC Stamp program needs to get a person’s attention or you want to create a sound effect. To produce movement, you can add a very useful device called a servo, which lets you control mechanical motion with a BASIC Stamp program.

Creating Sound with a Piezo Speaker and a BASIC Stamp

The BASIC Stamp Activity Kit (to which we introduce you in Chapter 1 of this minibook) comes with a small piezoelectric speaker, which you can connect directly to an I/O pin to create beautiful music. Well, perhaps the music is less than beautiful, but you can coax the BASIC Stamp into emitting a variety of squeaks, burps and squelches that resemble musical notes. Plus you can create interesting sound effects such as police sirens or chirping crickets. Figure 4-1 shows this handy little speaker.

Figure 4-1: The piezo­electric ...

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