Created
April 27, 2011 23:23
-
-
Save laras126/945458 to your computer and use it in GitHub Desktop.
MP3 Trigger
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
| #include <MP3Trigger.h> | |
| MP3Trigger trigger; | |
| const int piezoPin = A0; // piezo connected to analog pin 0 | |
| const int threshold = 100; | |
| int valueP = 0; | |
| int buttonState = 0; | |
| void setup() | |
| { | |
| trigger.setup(); | |
| } | |
| // Play a random track when sensor is activated. | |
| void loop() | |
| { | |
| valueP = analogRead(piezoPin); | |
| if (valueP > threshold) | |
| { | |
| int i = random(1,41); | |
| trigger.trigger(i); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment