Hi!
The vision: Arduino project with buttons. When one of the buttons is pushed, music and LED lights play till another button is pushed.
I’d like to wire up 6-8 pins for these buttons using a switch (schematic here
On the Music Shield wiki, it says Arduino pins D0-D9 are available, but I can’t get the musicPlayAll example to work when using these pins for other things.
I’m using the Music Shield, through a Proto Shield, to an Arduino Uno. (Nevermind the red circle)
On my Proto Shield, I wired pins D2-D5 to HIGH/LOW based on switches - they pass through to the Music Shield
musicPlayAll doesn’t play when { Music Shield + Proto Shield (pins 2-5 connected to switches) + Arduino UNO }
musicPlayAll plays music when { Music Shield + Proto Shield (pins 2-5 desoldered) + Arduino UNO }
musicPlayAll plays music when { Music Shield + Arduino UNO }
Switch Program detects the switch states when { Proto Shield (soldered) + Arduino UNO }
I bought the Music Shield because it said I could use these other pins. How do I do it?
I can’t tell if this is a hardware or software issue. What program would I use as a basis for this?
Thanks!
From the Wiki: seeedstudio.com/wiki/Music_Shiel … on_Arduino
D0 - Unused.
D1 - Unused.
D2 - Used for receiving signal from iPod dock(could be used for your own application if iPod dock is not used).
D3 - Used for receiving signal from button for Volume Up(could be used for your own application if the switch is not used).
D4 - Used for receiving signal from switch for Next Song function(could be used for your own application if the switch is not used).
D5 - Used for receive signal from switch for Play&Stop and Record function(could be used for your own application if the switch is not used).
D6 - Used for receive signal from switch for Previous Song function(could be used for your own application if the switch is not used).
D7 - Used for receiving signal from button for Volume Down(could be used for your own application if the switch is not used).
D8 - Used for Green Led instructions(could be used for your own application if the switch is not used).
D9 - Used for Red Led instructions(could be used for your own application if the switch is not used).
Switch program:
[code]/*
- Switch test program
*/
int switchPin = 2; // Switch connected to digital pin 2
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
pinMode(switchPin, INPUT); // sets the digital pin as input to read switch
}
void loop() // run over and over again
{
Serial.print(“Switch 2-5:”);
for (int i = 2; i<=5; i++)
{
Serial.print(digitalRead(i));
}
Serial.println();
delay(100);
}[/code]