Code & Programming

2-XL's new brain will be comprised of code adapted from the Wave Shield Voice project.  Download the code for the 2-XL Echo project from Github here:

Unzip the downloaded file and open the echo_2-xl.ino file in the Arduino IDE.

Install WaveHC library

To enable playback of wav files, download the WaveHC library for Arduino here and install it.  If you're unfamiliar with installing Arduino libraries, check out our tutorial here.

Once the library is installed, make sure everything is working by compiling the sketch in the Arduino IDE by choosing Sketch->Verify/Compile from the menu 

Upload to Metro

In the Arduino IDE, set the target board for Adafruit Metro by clicking Tools->Board->Adafruit Metro. If you don't see Adafruit Metro as an option, go here to install support for Adafruit boards. Next, choose the correct port for your board from the Tools->Port menu.

Connect the Metro to your computer via USB and upload the sketch using the Upload button in the upper left hand corner of the window.

Sound files

We'll use an SD card loaded into the Wave Shield to play audio samples. You can use the 2-XL samples I recorded - available here:

Make sure your SD card is formatted for FAT16 or FAT32 file system and place the sound files in the root directory. When you're done, insert the SD card into the slot on the Wave Shield.

This guide was first published on Aug 31, 2017. It was last updated on Aug 31, 2017.
This page (Code & Programming) was last updated on Mar 20, 2020.