Hardware Required

The Sketch

// Adapted from the Adafruit Paint application included with the TFT/Touchscreen library package to demonstrate both TFT and Touch Screen
// Code modified to draw a piano style keyboard and assign proper pitches to those keys so that they play the correct note when touched
// It is recommended to use a PDA type stylus for added touch precision with this sketch, as the piano keys are pretty small
// *** BE SURE TO SET THE "speaker" PIN VALUE CORRECTLY FOR YOUR ARDUINO BOARD ***
// Ver. 1.0 - Clay Furman 20 DEC 2012

#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>

const int speaker=19; //Pin to which the speaker is connected -- use 19 (this is the A5 pin, as a digital output) for Uno or 53 for Mega

}
//Wait for the tone to play -- you can adjust the scalar to make the gap between tones more pronounced -- and then kill the tone output to prepare for the next cycle
wait=duration*1;
delay(wait);
noTone(speaker);