Go Down

Topic: Have trouble about my arduino with Mp3 shield control by potentiometer (Read 737 times) previous topic - next topic

akiha

WE have  link a Mp3 shield with our arduino Uno and put a potentiometer on to analog A2 and hope it can swich between different tracks.
The number jump from 0-1200 @ the  potentiometer without a problem.
But when we load up the coldes and swhich the whole thing on. the mp3 tracks came up  very lag and with lots noice. And it does not change track while we turning the potentiometer.  Some times it change after a 20sec delay but the music is so laggy and noicey. compare with when we only use a normal digital swich to triger the track. can anyone help me out !
... 
thanks
This is the codes we use
Code: [Select]

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>

SdFat sd;
SFEMP3Shield MP3player;

int potPin = 2;    // select the input pin for the potentiometer
int val = 0;       // variable to store the value coming from the sensor




void setup() {

 Serial.begin(9600);
 pinMode(potPin, INPUT);  // declare the ledPin as an OUTPUT

 sd.begin(SD_SEL, SPI_HALF_SPEED);


}

//do something else now
void loop() {
 
 val = analogRead(potPin);
 Serial.println(val);
 MP3player.begin();
 
 if(val > 500){
   MP3player.playTrack(1);
 }
 if(val < 500){
 MP3player.playTrack(2);
 }

Nick Gammon

http://www.gammon.com.au/electronics

akiha

thanks for the notice.

Sadly noone can give me a bit of tips ; ;?

Go Up