#include <SoftwareSerial.h>
SoftwareSerial MyBlue(10,9); // RX | TX //Declaring The transmitter and receiver pin for bluetooth
char a; //Creat a variable for storing data
int RED = 11; //RED led pin is connected to digital pin 11
int GREEN = 12; //GREEN led pin is connected to digital pin 12
int BLUE = 13; //BLUE led pin is connected to digital pin 13
void setup()
{
Serial.begin(9600); //baud rate is set at 9600
*/ Phone Control Disco Lights /*
MyBlue.begin(9600);
pinMode(RED,OUTPUT);
pinMode(BLUE,OUTPUT); //Declairing all the pins of RGB as output device
pinMode(GREEN,OUTPUT);
}
void loop()
{
if (MyBlue.available())
a = MyBlue.read(); //collecting information from phone via bluetooth
if (a == 'F') //if string received via phone is F
{
digitalWrite(RED, HIGH);
digitalWrite(GREEN,LOW); //turn the RED led ON
digitalWrite(BLUE,LOW);
}
else if (a == 'B') //if string received via phone is B
{
digitalWrite(RED,LOW);
digitalWrite(GREEN,HIGH); //turn the GREEN led ON
digitalWrite(BLUE,LOW);
}
else if (a == 'R') //if string received via phone is R
{
digitalWrite(RED,LOW);
digitalWrite(GREEN,LOW); //turn the BLUE led ON
digitalWrite(BLUE,HIGH);
}
else if (a == 'L') //if string received via phone is L
{
digitalWrite(RED,HIGH);
digitalWrite(GREEN,HIGH); //turn ALL leds ON for white light
digitalWrite(BLUE,HIGH);
}
}