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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.