This project uses the Arduino Uno board and a bluetooth bee. In this project, the RGB LED on the breadboard is controlled using a phone via bluetooth terminal, where different input changes the color of the RGB LED.
Overview
For the device to communicate with the arduino, we would search for an open serial for communication. Hence, if the arduino is connected to the computer with the serial monitor on, the computer would be communicating with the serial instead, which makes it impossible for the device to communicate with the arduino.
Demo
Code
void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: pinMode(13, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); Serial.begin(9600); Serial.println("-----LED Bluetooth Control-----"); Serial.println("++++++++++ Commands +++++++++++"); Serial.println("Press 0 to turn off all colours."); Serial.println("Press 1 for Red."); Serial.println("Press 2 for Green."); Serial.println("Press 3 for Blue."); Serial.println("nEnter Command: "); digitalWrite(13, HIGH); digitalWrite(12, HIGH); digitalWrite(11, HIGH); } void loop() { if (Serial.available()){ char input = Serial.read(); switch (input){ case '0': //turn led on digitalWrite(13, HIGH); digitalWrite(12, HIGH); digitalWrite(11, HIGH); delay(100); Serial.println("LED Off"); break; case '1': //red on digitalWrite(13, LOW); digitalWrite(12, HIGH); digitalWrite(11, HIGH); delay(100); Serial.println("Red On"); break; case '2': //green on digitalWrite(13, HIGH); digitalWrite(12, LOW); digitalWrite(11, HIGH); delay(100); Serial.println("Green On"); break; case '3'://blue on digitalWrite(13, HIGH); digitalWrite(12, HIGH); digitalWrite(11, LOW); delay(100); Serial.println("Blue On"); break; } } }