:: VMUSIC ::
Here's some code that I put together in a Arduino workshop to control a VMUSIC 2 MP3 Module. It's very basic and waits for either of 3 buttons to be pressed that then corrospond with a particular track. I'll upload a diagram soon. But check the datasheet for the right connections.
http://www.ftdichip.com/Products/Modules/ApplicationModules.htm http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_VMUSIC2.pdf
#include <SoftwareSerial.h> // VMUSIC PIN 6 CTS goes to Arduino GND // VMUSIC PIN 3 goes to Arduino 5v // VMUSIC PIN 1 goes to Arduino GND #define VMUSIC_RX 6 #define VMUSIC_TX 7 #define ledPin 13 int incomingByte = 0; // for incoming serial data int buttonA = 3; // choose the input pin (for a pushbutton) int buttonB = 4; // choose the input pin (for a pushbutton) int buttonC = 5; // choose the input pin (for a pushbutton) int buttonValA = 0; // variable for reading the pin status int buttonValB = 0; // variable for reading the pin status int buttonValC = 0; // variable for reading the pin status int i = 0; int buttonValue = 0; // set up a new serial port SoftwareSerial mySerial = SoftwareSerial(VMUSIC_RX, VMUSIC_TX); void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps // define pin modes for tx, rx, led pins: pinMode(VMUSIC_RX, INPUT); pinMode(VMUSIC_TX, OUTPUT); pinMode(ledPin, OUTPUT); // declare LED as output pinMode(buttonA, INPUT); // declare pushbutton as input pinMode(buttonB, INPUT); // declare pushbutton as input pinMode(buttonC, INPUT); // declare pushbutton as input digitalWrite(buttonA, HIGH); digitalWrite(buttonB, HIGH); digitalWrite(buttonC, HIGH); // set the data rate for the SoftwareSerial port mySerial.begin(9600); } void selectTrack (int trackNumber) { switch (trackNumber) { case 49: Serial.print("I received: "); Serial.println(trackNumber, DEC); mySerial.print("VPF 001.mp3"); mySerial.print(0x0D,BYTE); //selectTrack(incomingByte); break; case 50: Serial.print("I received: "); Serial.println(trackNumber, DEC); mySerial.print("VPF 002.mp3"); mySerial.print(0x0D,BYTE); break; case 51: Serial.print("I received: "); Serial.println(trackNumber, DEC); mySerial.print("VPF 003.mp3"); mySerial.print(0x0D,BYTE); break; //default: // if nothing else matches, do the default // default is optional } } void checkbuttons (){ for (int i=3; i <=5; i++){ digitalRead(i); buttonValue = digitalRead(i); if (buttonValue == LOW){ digitalWrite(ledPin, HIGH); // turn LED ON selectTrack(i+46); Serial.print("hello"); delay(200); } else { digitalWrite(ledPin, LOW); // turn LED OFF } } } void loop() { checkbuttons(); }