Dog Training

The sketch we write will monitor the PIR for any motion events. If movement is detected, the shield will randomly play one of five different audio files stored on the wave shield’s SD card. Simultaneously, the servo motor rotates up to 150 degrees, depending on the sound effect being played back. Attach a wooden rod to the servo gear and the servo’s rotation will move the rod up and down. When the rod is positioned behind a curtain, it will give the illusion of a dog’s snout attempting to nudge the curtain aside so it can see who’s at the door or window.

To begin, we need to include the MediaPlayer.h header file along with its two dependencies, pgmspace.h (part of a memory management library included in the Arduino’s standard ...

Get Programming Your Home now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.