Skip to content

Instantly share code, notes, and snippets.

@abarth500
Last active July 9, 2019 01:51
Show Gist options
  • Save abarth500/3f8df1d5a181cc2f2259c557b4bb6b1b to your computer and use it in GitHub Desktop.
Save abarth500/3f8df1d5a181cc2f2259c557b4bb6b1b to your computer and use it in GitHub Desktop.
const int ledPin = 7;
const int speakerPin = 9;
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(7, OUTPUT);
pinMode(9, OUTPUT);
attachInterrupt(0, speaker, FALLING);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
void speaker() {
tone(speakerPin, 255, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment