Changes

Jump to: navigation, search

VMusic2 Anleitung

4,068 bytes added, 11:22, 25 February 2021
no edit summary
<pre>[[File:VMusic Arduino.jpg|400px|right]]
 == Komponenten == Zum Bau eines programmierbaren MP3-Players benötigen wir: <br>Der VMusic-MP3-Player wird von der Firma [http:// vMusicwww.ftdichip.com/Products/Modules/ApplicationModules.htm FTDI] entwickelt. Bis jetzt gibt es die Versionen VMusic, VMusic2, VMusic3 die sich jedoch in der Nutzung nicht wesentlich unterscheiden. Da es bei älteren Versionen Probleme mit Bugs gab, würde ich immer die jeweils neuste Version empfehlen. * VMusic3 -PlayOnSong by MP3-Player ([http://www.olafvaldigikey.de /product-detail/ more infode/VMUSIC3/768-1179-ND/4009908 zum Beispiel])* Arduino 5V ([http: www//arduino.vinculumcc/en/Main/ArduinoBoardPro zum Beispiel])* USB-Stick  <br> == Funktionsprinzip == Die MP3 Dateie werden auf dem USB-Stick gespeichert und können mit dem Sound-Chip des VMusic2-Moduls abgespielt werden.comDieses besitzt eine kleinen Klinkenstecker für Kopfhörer, Boxen, Aktiv-Boxen usw... Das VMusic2 wird von einem Arduino gesteuert. Das Arduino ist ein kleiner Computer, der sich leicht programmieren lässt. Er gibt dem VMusic2-Player einfache Befehle (siehe unten) über eine Serielle Verbindung. Der große Vorteil dieses selbst gebauten MP3-Players ist, dass wir genau programmieren können, was passiert. An das Arduino lassen sich Taster, Schalter uns Sensoren anschließen über die das Abspielen der MP3-Sounds gesteuert wird. Zusätzlich Kann das Arduino Leuchtdioden, Lampen, Motoren oder andere dinge in Kombination mir dem Sound steuern. Ein kleiner Nachteil liegt in leichten Verzögerung von ca. einer Sekunde, die es dauert bis der VMusic-Player reagiert.  <br>  == Steuerbefehle == VMusic Steuerbefehle * "VSV" = VMusic set volume – 0 (loud) and 254 (mute)* "VPF" = VMusic Play File* "VRF" = VMusic repeatedly plays a single file* "VST" = VMusic stop * "V3A" = VMusic plays all MP3 files* "VRA" = VMusic repeatedly plays all MP3 files* "VRR" = VMusic repeatedly plays random MP3 files* "VSF" = VMusic skip forward one track* "VSB" = VMusic skip back one track* "VSD" = VMusic skip forward on whole directory* "VP" = VMusic Pause playback* "VF" = VMusic fast forward 5 seconds* "VB" = VMusic rewind 5 seconds <br>  = Code-Beispiele = <br> == PlayOneSong == <source lang="java">/prd_vmusic1/ PlayOneSong with vMusic2 // Example by by Olaf Val (www.htmlolafval.de)
#include <SoftwareSerial.h>
// USB-stick max 4 G(hard to buy this days)// Format the Stick with FAT32// Name Songs "001.mp3" "002.mp3" . . .  
// cut the blue
// conect the brown to the reen cable
mySerial.print("VSV"); // set volume
mySerial.printwrite((byte)0,BYTE); // should be between 0 (loud) and 254 (mute) mySerial.printwrite((byte)0x0D,BYTE);
}
Serial.println("Song_1");
mySerial.print("VPF 001.mp3"); // play song nr one
mySerial.printwrite((byte)0x0D,BYTE);
delay(9000);
}
</source>
 
<br>
 
== PlayNextSong ==
 
<source lang = "java">
// PlayNextSong with vMusic2
// Example by by Olaf Val (www.olafval.de)
 
#include <SoftwareSerial.h>
 
// USB-stick max 4 G (hard to buy this days)
// Format the Stick with FAT32
// Name Songs "001.mp3" "002.mp3" . . .
 
// cut the blue
// conect the brown to the reen cable
// red cable to 5V
// black cable to GND
#define VMUSIC_RX 14 // yellow cable ti Analog in 0
#define VMUSIC_TX 15 // orange cable ti Analog in 1
 
 
// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(VMUSIC_RX, VMUSIC_TX);
 
int n = 0; // Song Nummer
int buttonPin = 17; // Button Pin
int b = 0; // Inputval of button
 
 
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);
 
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
 
mySerial.print("VSV"); // set volume
mySerial.write((byte)0x00); // should be between 0 (loud) and 254 (mute)
mySerial.write((byte)0x0D);
 
pinMode(buttonPin, INPUT); // setup Button Pin
digitalWrite(buttonPin, HIGH); // enable PullUpResistor for Button Pin
 
}
 
void loop() {
 
// wait untill button is pressed
b = digitalRead(buttonPin);
while(b == 1){
// wait untill button is pressed
b = digitalRead(buttonPin);
}
if(n == 0) mySerial.print("VPF 001.mp3"); // play song nr one
if(n == 1) mySerial.print("VPF 002.mp3"); // play song nr one
if(n == 2) mySerial.print("VPF 003.mp3"); // play song nr one
if(n == 3) mySerial.print("VPF 004.mp3"); // play song nr one
mySerial.write((byte)0x0D);
delay(1000);
 
n = n + 1;
if(n > 3) n = 0;
Serial.print("Song Nr ");
Serial.println(n);
delay(100);
}
</source>
</prebr>

Navigation menu