Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
int yellow = 7;
int red = 6;
int speakerPin = 8;
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(yellow, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(yellow, LOW); // turn the LED off by making the voltage LOW
delay(500);
digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
delay(500);
tone(speakerPin, 440, 200); //play tone on pin 8 of 440 Hz for 200 ms
delay(200);
tone(speakerPin, 240, 200); //play tone on pin 8 of 240 Hz for 200 ms
delay(200);
tone(speakerPin, 120, 200);
delay(200);
tone(speakerPin, 440, 200);
delay(200);
tone(speakerPin, 80, 200);
delay(200);
noTone(speakerPin);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.