sounds

Startup:

Version 1:

int speakerPin=8;

void setup(){
pinMode(8,OUTPUT);

}
void loop (){
for( int y=0; y<3000; y+=2) {
tone(speakerPin,random(10,y));
delay(4);

}

}

 

Version 2 (favorite):

int speakerPin=8;

void setup(){
pinMode(8,OUTPUT);

}
void loop (){
for( int y=0; y<3000; y+=2) {
tone(speakerPin,random(0,y));
delay(4);

}

}

 

Version 3:

 

int speakerPin=8;

void setup(){
pinMode(8,OUTPUT);

}
void loop (){
for( int y=0; y<3000; y+=2) {
tone(speakerPin,random(1000,y),6);
}

}

 

 

You are wrong-sounds:

Version 1:

  1. include “pitches.h”

int melody [] = {NOTE_A1,NOTE_B0,NOTE_D2};
int noteDurations [] = {1};

void setup() {

}

void loop() {
for (int thisNote = 0; thisNote < 3; thisNote++) {
int noteDuration = 1000/noteDurations[thisNote];
tone(8, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(8);
}

}

 

Version 2:

  1. include “pitches.h”

int melody [] = {NOTE_F1,NOTE_CS5,NOTE_CS8 };
int noteDurations [] = {1};

void setup() {

}

void loop() {
for (int thisNote = 0; thisNote < 3; thisNote++) {
int noteDuration = 1000/noteDurations[thisNote];
tone(8, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(8);
}

}

 

Version 3:

  1. include “pitches.h”

int melody [] = {NOTE_GS7,NOTE_CS7,NOTE_FS4 };
int noteDurations [] = {1};

void setup() {

}

void loop() {
for (int thisNote = 0; thisNote < 3; thisNote++) {
int noteDuration = 1000/noteDurations[thisNote];
tone(8, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(8);
}

}