I love this kind of lights, and the RGB led reminded me of this light , that give different colors by controlling it
i'm gonna use the blutooth module, and the arduino blucontrol to control the color i want to turn on, and every color gives different tune when it trun on
Arduino Uno
Tinkercad
Arduino bluecontrol
Electronics Tools :
breadboard
Jumper wires (Male_Male/Female)
arduino uno
Cable For Arduino UNO
I'm Using blutooth module to control the colors of the leds that i want to turn on
Bluetooth Module:
RX ===> TX Arduino Uno
TX ===> RX Arduino Uno
GND ===> -ve rail breadboard
Vcc ===> +ve rail breadboard
The Electrical circuit simulation on TinkerCad
RGB Led :
GND ===> negative rail on breadboard
Green RGB Led ===> pin 2 Arduino Uno
Blue RGB Led ===> pin 3 Arduino Uno
Red RGB Led ===> pin 4 Arduino Uno
Buzzer:
+ve ===> pin 5 Arduino Uno
-ve ===> negative rail on breadboard
The Code Writing
Variable Declaration:
-First i wrote char incomingData = '0'; This variable is used to store the incoming data from the serial communication.
Pin Definitions: then i wrote:
#define led2 2
#define led3 3
#define led4 4
#define Buzzer 5
This defines the leds and the buzzer with it's value , representing the pin number on the Arduino where the Leds and the buzzer are connected.
Setup Function:
Serial.begin(9600);: Initializes serial communication at a baud rate of 9600. This allows the Arduino to communicate with a computer or other devices.
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(Buzzer, OUTPUT);
Sets the leds and the buzzer pin as an output pin, meaning it will send voltage out to control the leds and the buzzer .
Waiting for Serial Data:
while (Serial.available() == 0); This line waits until there is data available to read from the serial connection.
Reading Incoming Data:
incomingData = Serial.read();This reads the incoming serial data and stores it in the incomingData variable.
Conditional Statements: The code then uses a series of if and else if statements to check the value of incomingData and perform different actions based on its value.
Bluetooth Module:
RX ===> TX Arduino Uno
TX ===> RX Arduino Uno
GND ===> -ve rail breadboard
Vcc ===> +ve rail breadboard
RGB Led :
GND ===> negative rail on breadboard
Green RGB Led ===> pin 2 Arduino Uno
Blue RGB Led ===> pin 3 Arduino Uno
Red RGB Led ===> pin 4 Arduino Uno
Buzzer:
+ve ===> pin 5 Arduino Uno
-ve ===> negative rail on breadboard
Bluetooth Controlling Application
I used an application called " Arduino bluecontrol " to link the blutooth module and the phone to control the RGB Led and The Buzzer.
Me and my teammate ( Ahmed) helped each other to make our (ابويا قالي ارمي الشباك باك)
we split the tasks to finish it on time
And Our instructor (Ahmed khaled) helped us to run the codes properly
when i got stuck:
I'm planing to use " blutooth Module" in my final project
And i this week, I've learnt how to use it so i hope it'll help me ( إن شاء الله ).