Pages: [1]   Go Down
Author Topic: Mp3 trigger v2 and Arduino Diecimila  (Read 1303 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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? smiley-confuse

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);
}





}

Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34243
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Two points of forum protocol.
1) Do not post the same thing in two different places it splits the information and people can waste time answering things that have already been answered. Plese go back to the other post and delete it.
2) When posting code select it and hit the # icon, that way it is in a nice box and doesn't get mangled. Please modify the post above.

You may know what "the mp3 trigger" is but most of us don't, if you are using external stuff then it is good to provide a link. We have no idea how this thing of yours connects to the arduino, or where to get the library from that you include in the sketch.

Finally you have not said how you have wired up your buttons, is there a pull up resistor? You don't seem to be using the internal ones.
Logged

Pages: [1]   Go Up
Jump to: