Tone

533

Posted

Introduction: Tone

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

Step 1: Connection

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

Step 2: 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

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest
    • Science of Cooking

      Science of Cooking
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments