Hey guys,i am a FNG in the world of arduino and i despreatly need help. My project is about the PIR sensor detecting motion and sending it to the Arduino Uno which will trigger the MP3 Shield,i have the code from online but how do u add the libraries to the sketch?
*/
// libraries
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
SFEMP3Shield MP3player;
// constant variables
int pirPin = 5; // PIR sensor input pin
int calibrationTime = 10;
unsigned long playTime = 15000; // how long a file will play in milliseconds (15000=15 seconds)
unsigned long pauseTime = 10000; // how long the pause will be after the sound ends (10000=10 seconds)
int readingInterval = 20; // how often to read the sensor
// changing variables
int rantrack = 0; // track number for randomizing
unsigned long currentMillis = 0; // time variable to track running time: current time
unsigned long startingMillis = 0; // time variable to track running time: starting time
byte result; // variable for mp3 player shield, can be used to debug
// setup
void setup() {
pinMode(pirPin, INPUT);
digitalWrite(pirPin, LOW);
//give the sensor some time to calibrate
for(int i = 0; i < calibrationTime; i++){
delay(1000);
}
delay(50);
pinMode(pirPin, INPUT); // make PIR sensor an input
digitalWrite(pirPin, LOW); // activate internal pull-up resistor
result = MP3player.begin(); // start mp3 player shield
MP3player.SetVolume(10, 10); // set volume of the mp3 player ( 0 = loudest )
}
// loop
void loop(){
if (digitalRead(pirPin)== HIGH) { // if movement sensed
randomSeed(millis()); // set a more random seed for the random function
rantrack = random(55); // find random number
result = MP3player.playTrack(rantrack); // play track
playtime(); // call function for play time
MP3player.stopTrack(); // stop track
delay(pauseTime); // wait...
}
delay(readingInterval); // wait with reading
}
// function to determine playtime
void playtime() {
startingMillis = millis(); // set both time counter
currentMillis = millis();
while ( currentMillis - startingMillis < playTime ) { // while track plays, runs until playTime is reached
currentMillis = millis(); // set to actual time
delay(40); // debounce
}
}
the help i need is in this:
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
SFEMP3Shield MP3player;
how do i add these??Please URGENTLY reply!!
Thank You