Now , I gonna make a smart circuit that can communicate wirelessly via a Graphical user interface
on my phone so , I wanna control RGB LED with DC Fan !
_ Software
Makes it easy to write code and upload it to the board offline
_ Electric components
Firstly , I built the circuit on TinkerCAD :
Brought the components needed ( Arduino Uno , RGB LED , 220 ohm resistor (3) , buzzer and breadboard) .
Then , put the RGB and buzzer on the breadboard.
After that , connected them to the Arduino as follows :
Red RGB pin on pin 3 on Arduino
Blue RGB in on pin 4 on Arduino
Green RGB in on pin 5 on Arduino
Buzzer on pin 6 on Arduino
After finishing building the circuit , opining Arduino IDE and start building the code .
Starting with defining the variable used .
Then , going to the void setup to define ( RGB LEDs & Buzzer ) as an output components .
After that , going to the void loop to make the conditions needed to give the action needed :
By clicking on button 1 on the button app , red LED of RGB lighten .
By clicking on button 2 on the button app , green LED of RGB lighten .
By clicking on button 3 on the button app , blue LED of RGB lighten .
By clicking on button 4 on the button app , buzzer makes a sound .
This is the code :
char incomingdata = (0);
int red = (3);
int green = (4);
int blue = (5);
int buzzer = (6);
void setup()
{
Serial.begin(9600);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
while(Serial.available() == 0);
incomingdata = Serial.read();
Serial.println(incomingdata);
if (incomingdata == '1') {
//red
digitalWrite(red, HIGH);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
digitalWrite(buzzer, LOW);
delay(1000);
}
else if (incomingdata == '2') { //green
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
digitalWrite(blue, LOW);
digitalWrite(buzzer, LOW);
delay(1000);
}
else if (incomingdata == '3') { //blue
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, HIGH);
digitalWrite(buzzer, LOW);
delay(1000);
}
else if (incomingdata == '4') {
digitalWrite(buzzer, HIGH);
}
else if(incomingdata == '5'){
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
digitalWrite(buzzer, LOW);
}
}
Firstly , I brought the components needed ( Arduino UNO , buzzer , RGB LED , 220 ohm resistor (3) , wires , breadboard , bluetooth module ) .
Then start building the circuit using the schematic of each one of these component ( RGB LED , Bluetooth module and buzzer).
I was forgetting to remove ( Tx & Rx) wires from the Arduino at first , which caused a problem during uploading the code ,
but with repetition , the problem was solved.
If I want to control my device wirelessly , It must help me to do that .
It was such a beautiful thing to know how to control a device or any circuit wirelessly , and I was happy to know how to do that .
We made a robot arm. 🥰
We enjoyed using them in Makeathon 2 to catch fishes.😂
And , by finishing we met a new friend , patta🐣😂🥰