Introduction: Tone

Picture of Tone

using tone function in arduino you can create tones(music)..

Step 1: Connection

Picture of Connection

connect speaker positive wire to pin number "8" and negative to the ground...

Step 2: Materials Required

Picture of Materials Required

  • arduino
  • speaker
  • couple of wires

Step 3: Code

for clear view of code click this link

http://pastebin.com/ax2ECgtu

//program

//black wire to ground int speakerPin = 8;//red wire connect to pin 8

void setup() {

pinMode(speakerPin,OUTPUT); } void loop() { tone(speakerPin, 2601); // m delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 8012); // a delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 5092); // h delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 1202); // e delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 6028); // s delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 5092); // h delay(1000); noTone(speakerPin); delay(1500);

////////////////////////////////////////

tone(speakerPin, 7031); // i delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 6028); // s delay(1000); noTone(speakerPin); delay(1500);

////////////////////////////////////////////

tone(speakerPin, 2071); // c delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 7068); // o delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 7068); // o delay(1000); noTone(speakerPin); delay(500);

tone(speakerPin, 3098); // l delay(1000); noTone(speakerPin); delay(1500);

}

Step 4: Video Link

Comments

About This Instructable

523views

0favorites

License:

Bio: i love electronics..........
More by maheshs11:Automatic/manual drip irrigationscary mushroom Air fire arrow
Add instructable to: