simple VMUSIC2 project query

Hello,

I'm wanting to use a flex sensor together with the VMUSIC2, so that the more the sensor is bent, the louder the mp3 plays.

So far I've managed to get the VMUSIC2 to play continuously, without a pushbutton, with help from here: Tech Art Blog: VMUSIC2 on Arduino

I've found this thread, which is interesting but a tad complex for what I'm trying to do: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206574227/1#1

I've tried to integrate if + else commands, but it doesn't work. I'm a super amateur, so if anyone has any tips having done this before, I'd be very grateful.

Thanks,
Miranda

I'm not familiar with the particular sensor you are using, or with VMUSIC2, but my general approach would be something like:

Set value to sensor reading.
Convert value to something acceptable by VMUSIC2 (e.g. scaling, etc)
Send value to VMUSIC2 volume command (presuming such a thing exists) via serial

Hi Simon,

Thanks for your help! It turns out that I managed to get the whole thing to work today, here's the code, below.

best,
Miranda

int buttonPin = 2; // pushbutton
int val = 0; // variable for reading the pin statusint
int ledPin = 13; // choose the pin for the LED
boolean triggered = false; //

void setup()

{
Serial.begin(9600);
pinMode(buttonPin, INPUT); // button is your input
pinMode(ledPin, OUTPUT); // declare LED as output

}

void loop () {

val = digitalRead(buttonPin); // read input value

if (val == HIGH && !triggered) // if button's pressed
{
triggered = true;
digitalWrite(ledPin, HIGH); // LED on
Serial.print("V3A"); // play all files
Serial.print(13,BYTE);

}

if (val == LOW && triggered)

{

triggered = false;
digitalWrite(ledPin, LOW); // LED off
Serial.print("VST"); //stop playing
Serial.print(13,BYTE);
}

}

As i read it, this is just for playing one file until the button is released. did you manage to intergrade the bend sensor?