SPRINT 2 BLUETOOTH - P-Division-2018-2019/Team-12 GitHub Wiki

Here the bluetooth module is used and execution is done via taking input from user.This sprint completes the working musical bot.

FLOWCHART :

PROGRAM :

#include <Servo.h>

Servo servo1,servo3;

int ledPin = 13; // select the pin for the LED

int slidePos;

void setup()

{

Serial.begin(9600);

pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT

servo1.attach(9);

delay(10);

servo1.write(110); // put finger at starting position

servo3.attach(10);

delay(10);

servo3.write(71); // position slider at starting position

//delay(5000); // wait 5 seconds before beginning

}

void playKey(int slidePos)

{

servo3.write(slidePos); // move slider servo to key position

delay(300); // give slider time to get there

servo1.write(85); // move finger down and press key

delay(100); //give time to move finger down

servo1.write(110); //pick finger back up

delay(300); //give time to pick finger up before next slider move

}

void loop()

{

char blue=NULL;

blue = Serial.read();

digitalWrite(ledPin,HIGH);

Serial.println(blue);

servo1.write(110);// put finger at starting position

delay(10);

servo3.write(71); // position slider at starting position

if(blue=='1')

{

playKey(72); // avengers //

playKey(94);

playKey(83);

playKey(50);

playKey(15);

playKey(28);

playKey(72);

playKey(94);

playKey(83);

delay(2000);

blue=NULL;

}

if(blue=='2')

{

//gilligan

playKey(138);

playKey(105);

playKey(61);

playKey(61);

playKey(61);

playKey(72);

playKey(94);

playKey(116);

delay(500);

playKey(138);

playKey(105);

playKey(61);

playKey(61);

playKey(61);

playKey(72);

delay(500);

playKey(138);

playKey(105);

playKey(61);

playKey(61);

playKey(61);

playKey(72);

playKey(28);

delay(500);

playKey(72);

playKey(83);

delay(500);

playKey(94);

playKey(116);

playKey(105);

delay(2000);

blue=NULL;

}

if(blue=='3')

{

// indiana jones

playKey(138);

playKey(127);

playKey(116);

playKey(83);

delay(500);

playKey(149);

playKey(138);

playKey(127);

delay(500);

playKey(116);

playKey(105);

playKey(94);

playKey(50);

playKey(105);

playKey(94);

playKey(83);

playKey(72);

playKey(61);

delay(2000);

blue=NULL;

}

if(blue=='4')

{

// somewhere over the rainbow

playKey(127);

delay(300);

playKey(50);

delay(300);

playKey(61);

delay(300);

playKey(83);

playKey(72);

playKey(61);

playKey(50);

delay(200);

playKey(125);

delay(300);

playKey(72);

delay(300);

playKey(83);

blue=NULL;

}

}

SPRINT 2:EXTERNAL CONNECTIVITY IMAGE

IMAGE 2- BLUETOOTH APP

Functionality

In this phase a Bluetooth module is designed to give input to the bot , to play one of the 4 tunes .And at the end of each tune the slider is bought to the initial position.

Testing

In this testing phase , inputs are given continuously to check the output

⚠️ **GitHub.com Fallback** ⚠️