DHF Capstone project

For my DHF Capstone project I decided to use a servo to have an ever looping punching fist while a piezo plays a song of my choosing in the background. I decided to make that because I knew I wanted a musical element in it and for my servo design i had a 2d fist so making a 3D one that actually extends would be better and a sort of expansion. I used analog inputs for this because it’s how I learned how to do this. I also used analog outputs to do this. ( The song code is unfinished)

int speakerPin = 9;

int numTones = 23;
int tones[] = {294, 294, -2, 294,294,294,294,294,294, -2, -2, -2, -2, 340, 340, -2, -2, 340, 340, 340, 340, 349, 340, -2, -2, -2, -2, 349, 349, -2, -2, 349, 349, 349, 349, -2, -2, -2, 349, 349, 225, 225, 225, 225, 225, 225 };

void setup() {

}

void loop() {20161110_170903
for (int i = 0; i < numTones; i++) {
tone(speakerPin, tones[i]);
delay(200);

}
}

//{261, 277, 294, 311, 330, 349, 370, 392, 415, 440} 247, 225
//mid C C# D D# E F F# G G# A low A G

Submit a Comment