As I have not enough time to wait for the waveshield
I tried to find another way of playing the music file.
But im getting an error ;<
This is the code I used:-
#include <Servo.h>
import ddf.minim.;
import processing.serial.;
#define MOTOR 4 //motor is plugged in to pin 4
#define SENSOR 7 //button is plugged in to pin 7
#define LED 13
int trigger = 1;//if button's not pressed, trigger = 0, else trigger = 1
Minim minim;
AudioPlayer player;
Servo myservo;
void setup()//initializing
{
minim = new Minim(this);
player = minim.loadFile("filename.mp3",2048);
port = new Serial(this, Serial.list()[MOTOR],9600);
size(10,10);
myservo.attach(MOTOR);
pinMode(LED , OUTPUT);
pinMode(SENSOR , INPUT);
//setting button(7) as an INPUT
}
int move = 0;//movement of the motor in degrees(angle)
void loop()
{
trigger = digitalRead(SENSOR);
//checks if the button is pressed or not
if(trigger == 0)//if the sensor detects darkness
{//move the motor
digitalWrite(LED , HIGH);
delay(2000);//wait for 2 seconds
//moves the motor 30 degrees 0 to 30
//move += 1 increments the value of move by 1
for(move = 0; move < 30; move += 1)
{
myservo.write(move);//move the motor by the given value
delay(4);//waits for 4ms
}//end of for
player.play();
delay(1000); //wait for 1 sec
//this for loop moves back the position of the motor from 30 degrees to 0
//move -= 1 decrements value of move by 1
for(move = 30; move >= 0; move -= 1)
{
myservo.write(move);
delay(5);
}
delay(1000);
}//end of if
else
digitalWrite(LED , LOW);
}
void stop()
{
player.close();
minim.stop();
super.stop();
}
The error msg says, import does not name a type???
I'm not sure what im doing wrong :S