Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Bluetooth-Controlled LED System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Bluetooth-Controlled LED System

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller, an HC-05 Bluetooth module, and two LEDs (one blue and one green). The Arduino UNO is used to control the LEDs based on commands received via Bluetooth from the HC-05 module. The blue LED is connected to digital pin 7, and the green LED is connected to digital pin 6 of the Arduino. The HC-05 module communicates with the Arduino via serial communication.

Component List

HC-05 Bluetooth Module

Arduino UNO

LED: Two Pin (blue)

LED: Two Pin (green)

Wiring Details

HC-05 Bluetooth Module

Arduino UNO

LED: Two Pin (blue)

LED: Two Pin (green)

Code Documentation

char BluetoothData;
int LED1 = 7;
int LED2 = 6;

void setup() 
{
    pinMode(LED1, OUTPUT);
    pinMode(LED2, OUTPUT);
    Serial.begin(9600);
}

void loop() 
{
    if (Serial.available())
    {
        BluetoothData = Serial.read();
        Serial.println(BluetoothData);
    }

    // CONTROL LED1
    if (BluetoothData == '1')
    {
        digitalWrite(LED1, 1);
    }

    if (BluetoothData == '2')
    {
        digitalWrite(LED1, 0);
    }

    // CONTROL LED2
    if (BluetoothData == '3')
    {
        digitalWrite(LED2, 1);
    }

    if (BluetoothData == '4')
    {
        digitalWrite(LED2, 0);
    }

    // CONTROL ALL LEDS
    if (BluetoothData == '5')
    {
        digitalWrite(LED1, 1);
        digitalWrite(LED2, 1);
    }

    if (BluetoothData == '6')
    {
        digitalWrite(LED1, 0);
        digitalWrite(LED2, 0);
    }
}

This code initializes the pins connected to the LEDs as output and sets up serial communication at a baud rate of 9600. In the main loop, it reads data from the Bluetooth module and controls the LEDs based on the received commands.