Help with android to arduino interaction

Hi Guys, so this is my first post and i was enquiring some help or guidance on where to look as of now, i have setup between my arduino nano and a HC-06 module connected to my android phone. From a bluetooth terminal i can change the colours on the RGB LED with "phrases" (just 1 to 8 for some random colours) all of this works beautifully, however i would like to try and take things to the next level.

I dont know what the required libraries are if any however, i would like to when i get just a generic notification from an app on my phone have it talk over bluetooth to the arduino and have the arduino resolve that into a colour for the LED.

I don't even know if this is possible but if anyone can help or point me in the right direction that would be amazing!

Kind Regards,

Liam.

COMPONENTS:

Arduino Nano
4-pin RGB LED
HC-06 - 6 pin Bluetooth module

// pin variables
int pwr = 12;
int ledR = 11;
int ledB = 10;
int ledG = 9;

void setup() {
Serial.begin(9600);
//define pins
pinMode(pwr, OUTPUT);
pinMode(ledR, OUTPUT);
pinMode(ledB, OUTPUT);
pinMode(ledG, OUTPUT);
}

void loop() {

while (Serial.available() == 0);

int val = Serial.read() - '0';

digitalWrite(pwr, HIGH);

switch (val) {
case 1:
Serial.print("RED");
digitalWrite(ledB, LOW);
digitalWrite(ledG, LOW);
digitalWrite(ledR, HIGH);
break;

case 2:
Serial.print("GREEN");
digitalWrite(ledB, LOW);
digitalWrite(ledR, LOW);
digitalWrite(ledG, HIGH);
break;

case 3:
Serial.print("BLUE");
digitalWrite(ledG, LOW);
digitalWrite(ledR, LOW);
digitalWrite(ledB, HIGH);
break;

case 4:
Serial.print("PURPLE");
digitalWrite(ledG, LOW);
digitalWrite(ledR, HIGH);
digitalWrite(ledB, HIGH);
break;

case 5:
Serial.print("AQUA");
digitalWrite(ledG, HIGH);
digitalWrite(ledR, LOW);
digitalWrite(ledB, HIGH);
break;

case 6:
Serial.print("ORANGE");
digitalWrite(ledG, HIGH);
digitalWrite(ledR, HIGH);
digitalWrite(ledB, LOW);
break;

case 7:
Serial.print("WHITE");
digitalWrite(ledG, HIGH);
digitalWrite(ledR, HIGH);
digitalWrite(ledB, HIGH);
break;

case 8:
Serial.print("OFF");
digitalWrite(ledG, LOW);
digitalWrite(ledR, LOW);
digitalWrite(ledB, LOW);
break;

default:
Serial.print("INVALID");
break;

}
}

For the Arduino code have a look at Serial Input Basics

I am not familiar with Android programming.

...R

Thanks man, ill give it a read! Really handy stuff do you know any other awesome repositories like that, just so i can get a global view at it all, anything relating to bluetooth input would be amazing too!

Again thanks heaps have a good one.

Kind Regards,

Liam.

do you know any other awesome repositories like that,

Why don’t people ever read what is in plain sight ?