Guide

1/12/2018 mbed Starter Kit Experiment Guide - learn.sparkfun.com
https://learn.sparkfun.com/tutorials/mbed-starter-kit-experiment-guide/all 60/65
}
}
Run
Insert the micro SD card into the USB to micro SD card adapter and insert the USB adapter into your computer. Copy the following .wav files to the SD’s root
directory:
good_morning.wav
lack_discipline.wav
questions.wav
stop_whining.wav
Remove the SD card from your computer and plug it into the breakout board on the soundboard project.
Compile the program and copy the downloaded file to the mbed. Press the mbed’s reset button to start running the program. Press one of the 4 buttons to hear a
sound clip!
Concepts
This project was larger than the others before it. There are a number of things going on, but most of them we covered in previous tutorials.
Amplifier
In addition to adding a speaker to play sounds, we created a very simple amplifier to increase the signal strength (and the volume). We used an NPN transistor
(specifically, a 2N3904) that converts a small current through its base into a larger current through its collector. If we tried to power the speaker directly from the
mbed’s pin, we would likely draw enough power to hurt the processor. Audio amplifiers can be quite complex. Read more about them here.
Internal Pull-ups
When we used buttons in previous tutorials, we used external pull-up resistors on the buttons to prevent a floating pin. In order to save board space for this
project, we used mbed’s internal pull-ups. These are resistors internal to the mbed processor and can be enabled for each of the pins with the following line of
code:
pin_name.mode(PullUp);
Going Further
In this demo, we combined many concepts to create a fun project. We made a simple amplifier to play sounds and relied on the wave_player library to read .wav
files. Adding sound to a project can add a layer of interactivity and bring it to life.
Beyond the Tutorial
Download or create your own .wav files and play them using our soundboard. Note: you might have to use an editing program like Audacity to convert
sound clips into .wav files if they do not play on the mbed.
Add lights! Program some LEDs to flash whenever a clip is being played.
You might need some extra components not found in the kit, but can you get a sound recorder to work on the mbed? (Hint: see the Simple Wave Recorder
& Player library)
Digging Deeper
Read about the internals of a WAVE file
Look into how analog-to-digital converters (ADC) work
Want to talk to your mbed with voice recognition? Check out Jim Hamblen’s EasyVR tutorial
The End!
This demo finishes up our 10-part series on the mbed. We covered a number of topics that are considered important to embedded systems: buttons, LEDs,
GPIO, ADC, DAC, interrupts, SPI, I2C, UART, etc. You had the opportunity to search for libraries on mbed.org, import them into your program, and run some
basic firmware on the LPC1768. By now, you have had a good exposure to the building blocks of embedded programming on the mbed and should be ready to
tackle your first project.
Make something cool! Take a picture of it and tag @sparkfun or @mbedmicro on Twitter. Or, post your project to the mbed.org Cookbook.