Created
October 16, 2018 17:26
-
-
Save bboyho/e7eddf00f819e804552f0776ac09c548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pitches.h" // must include open source pitches.h found online in libraries folder or make a new tab => https://www.arduino.cc/en/Tutorial/toneMelody | |
int button1State = LOW; | |
void setup() { | |
pinMode(4, INPUT_PULLUP); | |
pinMode(5, OUTPUT); | |
} | |
void loop() { | |
button1State = digitalRead(4); | |
if (button1State == LOW) { | |
// Play coin sound | |
digitalWrite(5, HIGH); // turn the LED on | |
tone(10, NOTE_B5, 100); | |
delay(100); | |
tone(10, NOTE_E6, 850); | |
delay(800); | |
noTone(10); | |
digitalWrite(5, LOW); // turn the LED on | |
} | |
else { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment