[kayalvizhijayavel.jayavel] Fwd: RGB STRIP

  • From: Kayalvizhi Jayavel <kayalvizhijayavel.jayavel@xxxxxxxxx>
  • To: "kayalvizhijayavel.jayavel" <kayalvizhijayavel.jayavel@xxxxxxxxxxxxx>
  • Date: Tue, 9 Feb 2016 16:00:20 +0530

AMR_Voice software : download from google play in android ... Enable
bluetooth and scan for devices... And use HC05_Slave (Bluetooth module)..
And if it is one led then give voic e command accordingly
---------- Forwarded message ----------
From: Sri Vignesh N <nsrivignesh12@xxxxxxxxx>
Date: Tue, Feb 9, 2016 at 3:44 PM
Subject: RGB STRIP
To: Kayalvizhi Jayavel <kayalvizhijayavel.jayavel@xxxxxxxxx>


String voice;
int
led_r = 8, //Connect red to Pin #8
led_g = 12, // Connect green to Pin #12
led_b = 13; //Connect blue to Pin #13

//-----------------------------------------------------------------------//
void setup() {
  Serial.begin(9600);
  pinMode(led_r, OUTPUT);
pinMode(led_g, OUTPUT);
pinMode(led_b, OUTPUT);

}
//-----------------------------------------------------------------------//
void loop() {
  while (Serial.available())
  {  //Check if there is an available byte to read
  delay(10); //Delay added to make thing stable
  char c = Serial.read(); //Conduct a serial read
  if (c == '#')
  {
  break;
  } //Exit the loop when the # is detected after the word
  voice += c; //Shorthand for voice = voice + c
  }
  if (voice.length() > 0) //checking if any command is received
{
    Serial.println(voice); // print the command in the serial monitor
//-----------------------------------------------------------------------//

  //----------Turn On One-By-One----------//
  if(voice == "*red") // received command is red
  {
  digitalWrite(led_r, HIGH);
digitalWrite(led_g, LOW);
digitalWrite(led_b, LOW);
  }
  else if(voice == "*green") //received command is green
  {
  digitalWrite(led_r, LOW);
digitalWrite(led_g, HIGH);
digitalWrite(led_b, LOW);

}
  else if(voice == "*blue") // received command is blue
  {
  digitalWrite(led_r, LOW);
digitalWrite(led_g, LOW);
digitalWrite(led_b, HIGH);
}
else if(voice == "*switch off") // Switch off all the lights
  {
  digitalWrite(led_r, LOW);
digitalWrite(led_g, LOW);
digitalWrite(led_b, LOW);

}
else if(voice == "*white") // Switch on all the three for getting white
color
  {
  digitalWrite(led_r, HIGH);
digitalWrite(led_g, HIGH);
digitalWrite(led_b, HIGH);
}
//-----------------------------------------------------------------------//
voice="";}
} //Reset the variable after initiating




-- 
Kayalvizhi Jayavel
Assistant Professor
Department of IT
SRM University

Other related posts:

  • » [kayalvizhijayavel.jayavel] Fwd: RGB STRIP - Kayalvizhi Jayavel