Created
May 21, 2015 14:27
-
-
Save t-kashima/fa85b7faf9ba7957ebb1 to your computer and use it in GitHub Desktop.
Slide swith and speaker for Arduino
This file contains hidden or 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
void setup() { | |
pinMode(11, OUTPUT); | |
pinMode(12, OUTPUT); | |
pinMode(13, INPUT); | |
digitalWrite(12, HIGH); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
if (digitalRead(13) == HIGH) { | |
// digitalWrite(11, HIGH); | |
tone(11, 262, 300); | |
delay(300); | |
tone(11, 294, 300); | |
delay(300); | |
tone(11, 330, 300); | |
delay(300); | |
} else { | |
noTone(11); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment