Hi all,
I’m a relative newcomer, trying to teach myself electronics and get into some fun Arduino projects.
I’ve familiarised myself with the Arduino Uno through a range of tutorials, and created basic prototype circuits & sketches such as for moving servos in relation to range sensors, etc.
As such, my current problem seems like a step backwards, but I’m absolutely stumped despite spending several hours Googling solutions.
INGREDIENTS:
Arduino Uno
MP3 Trigger WIG-11029
Simple push button
GOAL:
To use a button connected to the Arduino to trigger a track when pressed, then trigger a different track when released.
PROBLEM:
Any Arduino digital pin connected to an input on the MP3 trigger causes the relevant track to start over and over, with seemingly random timing, regardless of the state of the pin (HIGH/LOW, INPUT/OUTPUT).
Pin set using pinMode(XXX, OUTPUT): Several times a second
Pin set using pinMode(XXX, INPUT_PULLUP): Every few seconds
Pin set using pinMode(XXX, INPUT): As above
The only pins it won’t do this with are those left as analog inputs.
QUESTION:
Is there something painfully obvious I’m overlooking about the MP3 trigger?
Will I have to resort to using serial communication instead of the digital pins? (I’d hoped I wouldn’t have to since it’s even further above my current skill level)
If so, can anyone point me to a tutorial for that, because I really can’t find one!
EXAMPLE SKETCH:
const int switchPin = 6;
const int soundPin = 11;
int val;
void setup() {
pinMode(switchPin, INPUT_PULLUP);
pinMode(soundPin, INPUT);
}
void loop() {
val = digitalRead(switchPin);
if (val == LOW) {
pinMode(soundPin, OUTPUT);
delay(20);
pinMode(soundPin, INPUT);
}
}
Simple stuff, right? This is unconnected to the “GOAL” above; it’s just one of many things I’ve tried tonight.
NOTES:
*All inputs on the MP3 trigger work normally when simply connecting its onboard ground column to each input. All tracks are fine, as are the random and stop commands I’ve placed on inputs 17 and 18. The nav button also works fine. I’m getting the standard three LED blinks on startup.
*I’ve tested simple sketches changing out the MP3 trigger for LEDs, and they work fine.
*I’ve soldered socket headers onto the ground and input columns on the MP3 trigger. I think my handiwork is fine, especially since the thing works fine by itself… but I’m mentioning it for full disclosure.
Any advice or guidance you can provide would be much appreciated.
I’m tearing my hair out over here!
XRay