Ohm Awasthi
Published © CC BY-NC-SA

DIY BLUETOOTH CONTROL RGB FROM MOBILE(ARDUINO UNO and HC-...

how to make bluetooth RGB LED control using Arduino uno which can be control from mobile. This can be used for decorating your house or maki

BeginnerFull instructions provided1 hour255
DIY BLUETOOTH CONTROL RGB FROM MOBILE(ARDUINO UNO and HC-...

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematics

Code

Arduino bluetooth code

C/C++
#include

SoftwareSerial BLU(0,1);

#define redPin 6 #define greenPin 3 #define bluePin 5

void setup() { //Serial setup Serial.begin(9600); Serial.println("-= HC-05 Bluetooth RGB LED =-");

BLU.begin(9600); BLU.println("-= HC-05 Bluetooth RGB LED =-"); pinMode(4, OUTPUT); digitalWrite(4,HIGH);

pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT);

setColor(255, 0, 0); delay(500); setColor(0, 255, 0); delay(500); setColor(0, 0, 255); delay(500); setColor(255, 255, 255); }

void loop() { while (BLU.available() > 0) { int redInt = BLU.parseInt(); int greenInt = BLU.parseInt(); int blueInt = BLU.parseInt();

redInt = constrain(redInt, 0, 255); greenInt = constrain(greenInt, 0, 255); blueInt = constrain(blueInt, 0, 255);

if (BLU.available() > 0) { setColor(redInt, greenInt, blueInt);

Serial.print("Red: "); Serial.print(redInt); Serial.print(" Green: "); Serial.print(greenInt); Serial.print(" Blue: "); Serial.print(blueInt); Serial.println();

BLU.flush(); } } }

void setColor(int red, int green, int blue) { analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue); }

Credits

Ohm Awasthi

Ohm Awasthi

1 project • 4 followers

Comments