Dears,
I used in my project android and bluetooth to control RGB strip 5050 , the first question is 5050 strip has a moving light like addressable rgb , the second question my code of arduino is
#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11);
String color;
void setup() {
BT.begin(9600);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
}
void loop() {
while (BT.available()){
delay(10);
char c = BT.read ();
color += c;
}
if (color.length() > 0) {
Serial.println(color);
if (color == "blue")
{
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
delay(20);
}
else if (color == "green")
{
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
delay(20);
}
else if (color == "red")
{
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
delay(20);
}
else if (color == "stop")
{
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
delay(20);
else if (color == "Flash")
{
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(1000);
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(3, LOW);
delay(1000);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
delay(1000);
}
my question in the last part ( when color is Flash ) , flash word comes from android through bluetooth to apply blue then off then green then off then red then off but and wants to stay flasher blue , green and red , blue , green and red etc... not just once but if i press for example stop button from my android and want it to stop not stay flashing , so how i can do this
thank you