COSC 4290 Embedded Systems
Spring 2014
Homework Assignment #3
"And when the music stops, the rest is silence..."
--Merrick, Buffy The Vampire Slayer
Due: Wednesday, February 12th, 11:00am CST
Submit: Turn your C source file
using the
turnin command on
the
Systems Lab
machines.
Expect to present a demonstration of your system during lab time.
Work is to be completed individually.
Pulse Width Modulation
Plug your mbed into the mbed application board, being careful to correctly align the pins
on the inner headers with proper orientation.
Following the examples given in the textbook and on the website,
construct a program that reads analog values from the two
potentiometers, (analog inputs on pins 19 and 20,) and uses those
values to alter the colors of the RGB LED, (PWM outputs on
pins 23 [red], 24 [green] and 25 [blue].)
Music
When the joystick center button is pushed (digital input on pin 15,) your
mbed should play a tune on the speaker (PWM output on pin 26.) Example
frequency tables and song data are included at the end of chapter 4.
Optional Enhancements
Once you have the required functionality in place, here are some possible
extensions you could consider:
- Use the other dimensions of the joystick inputs to alter the
third LED color.
- Rather than the obvious correspondence between the analog potentiometer
inputs and two of the LED output, devise a more complex mapping that allows
two potentiometers to explore a different region of the three-dimensional
LED color space.
- Use serial input from the host keyboard (see the PC serial port
examples in the book) to trigger different notes on the speaker. With
some practice, one could play a song on the mbed with keyboard inputs.
(Use minicom -S /dev/ttyACM0 -b 9600 on the Linux host to connect
to the mbed serial port.)
Back
[Revised 2014 Feb 12 13:33 DWB]