Hi Everyone.
I'm using the mp3 trigger, by connecting it to the arduino and using push buttons to trigger the tracks. My code works with one button; but the moment I add two or more buttons the Status light on the mp3 trigger indicates that there is a problem and none of the buttons work??? Ive also checked my connections etc those are fine. Im also using the mp3 trigger library. can anybody help? Any Ideas? :~
below is the code for one button(which works)
#include <MP3Trigger.h>
MP3Trigger trigger;
//int sensor1 = 0; //analogue input
//int Value1 = 0;
int Value2 = 0;//Value of Sensor
int button = 9;
void setup()
{
Serial.begin(9600);
//start serial communication with the trigger (over Serial)
trigger.setup();
pinMode(button, INPUT);
}
void loop()
{
Value2 = digitalRead(button); // read input value
if(Value2 == HIGH)
{
trigger.trigger(6);
}
//else
//{
//
//}
}
Below is the code for multiple buttons(which doesnt work):
#include <MP3Trigger.h>
MP3Trigger trigger;
//int sensor1 = A0; //analogue input LDR
//int Value1 = 0; // button1
int Value2 = 0;//Value of Sensor
int Value3 = 0; //button2
int Value4 = 0; // button3
int button1 = 7;
int button2 = 6;
int button3 = 3;
void setup()
{
Serial.begin(9600);
//start serial communication with the trigger (over Serial)
trigger.setup();
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
}
void loop()
{
Value2 = digitalRead(button1);
if(Value2 == HIGH);
{
trigger.trigger(5);
}
Value3 = digitalRead(button2); //button2
if(Value3 == HIGH);
{
trigger.trigger(11);
}
Value4 = digitalRead(button3); //button3
if(Value4 == HIGH);
{
trigger.trigger(10);
}
}