Skip to content

Instantly share code, notes, and snippets.

@ringodin
Created September 1, 2016 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ringodin/5c04319364e43625697586a058777b17 to your computer and use it in GitHub Desktop.
Save ringodin/5c04319364e43625697586a058777b17 to your computer and use it in GitHub Desktop.
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