Project showcase
Control RGB LED using Bluetooth

Control RGB LED using Bluetooth © GPL3+

This project helps you with the connections of controlling RGB LED with Bluetooth module and Arduino Uno.

  • 15,743 views
  • 1 comment
  • 14 respects

Components and supplies

Apps and online services

About this project

Hey everyone,

This project shows you how to control an RGB LED using Bluetooth. Check out this video:

Code

Untitled fileC/C++
#include <SoftwareSerial.h>
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);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  digitalWrite(4,HIGH);
  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);
}

Comments

Similar projects you might like

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 25,947 views
  • 4 comments
  • 50 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 13,963 views
  • 7 comments
  • 33 respects

Control an LED with the Remote Control

Project showcase by Nicholas_N

  • 9,831 views
  • 3 comments
  • 16 respects

Control a RGB Led using Arduino and a smartphone's camera

Project tutorial by Mr robot Maker

  • 3,119 views
  • 0 comments
  • 10 respects

Control LED Using Your Voice Command

by Team IoTBoys

  • 27,053 views
  • 4 comments
  • 30 respects

RGB LED Cube With Bluetooth App + AnimationCreator

Project showcase by PhilKey

  • 3,346 views
  • 1 comment
  • 21 respects
Add projectSign up / Login