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 consists of an Arduino UNO microcontroller, an HC-06 Bluetooth module, and two LEDs (one blue and one green). The Arduino UNO is used to control the LEDs based on commands received via the HC-06 Bluetooth module. The LEDs are connected in such a way that they can be turned on or off based on the received commands.

Component List

Arduino UNO

HC-06

LED: Two Pin (blue)

LED: Two Pin (green)

Wiring Details

Arduino UNO

HC-06

LED: Two Pin (blue)

LED: Two Pin (green)

Code Documentation

// generated by mBlock5 for <your product>
// codes make you happy

#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>

SoftwareSerial Bluetooth(10,11);
char Data;

void _delay(float seconds) {
  long endTime = millis() + seconds * 1000;
  while(millis() < endTime) _loop();
}

void setup() {
  Bluetooth.begin(38400);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  while(1) {
      if(Bluetooth.available()) {
          Data=Bluetooth.read();
          // LED 1 on
          if (Data==('5')) {
              digitalWrite(5,1);

          }
          // LED 1 off
          if (Data==('1')) {
              digitalWrite(5,0);

          }
          // LED 2  on
          if (Data==('6')) {
              digitalWrite(6,1);

          }
          // LED 2  off
          if (Data==('2')) {
              digitalWrite(6,0);

          }
          // LED 3 on
          if (Data==('7')) {
              digitalWrite(7,1);

          }
          // LED 3 off
          if (Data==('3')) {
              digitalWrite(7,0);

          }
          // ALL LEDS on
          if (Data==('9')) {
              digitalWrite(5,1);
              digitalWrite(6,1);
              digitalWrite(7,1);

          }
          // ALL LEDS off
          if (Data==('0')) {
              digitalWrite(5,0);
              digitalWrite(6,0);
              digitalWrite(7,0);

          }

      }

      _loop();
  }

}

void _loop() {
}

void loop() {
  _loop();
}

This code initializes the Bluetooth module and sets up three pins (5, 6, and 7) as outputs. It continuously checks for available data from the Bluetooth module and performs actions based on the received data. The actions include turning on or off the LEDs connected to pins 5, 6, and 7.