devkopunec
Published © GPL3+

Control LED with Bluetooth!

This tutorial explains how to connect Arduino and Bluetooth module (HC-06, but HC-05 can be used too).

IntermediateFull instructions provided19,967
Control LED with Bluetooth!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
HC-06 Bluetooth Module
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×1
9V battery (generic)
9V battery (generic)
Optional
×1

Software apps and online services

Arduino IDE
Arduino IDE
Cover art Smart Bluetooth - Arduino Bluetooth Serial ⚡

Story

Read more

Schematics

Schematics Fritzing

This is the schematic for this project made in Fritzing

Schematic EasyEDA

This is the schematic for this project made in EasyEDA

Code

smartbluetooth_blink

C/C++
This is the main code for this project
/* Made by Tomas Kopunec
 *  2.22.2019
 *  
 *  By default SMART BLUETOOTH app
 *  sends 'a' when turning ON and 'b' when turning OFF
 * 
 *  If you have any questions or issues
 *  don't hesitate and send me a message here: devkopunec@gmail.com
 *  
 *  Don't forget to leave a 5-star rating and nice feedback
 *  
 *  Thanks, Kopunec
 */


const int led = 2;

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

void loop() {
  char c = Serial.read();
  if(c == 'a'){
    digitalWrite(led, HIGH);
  }
  else if(c == 'b'){
    digitalWrite(led, LOW);
  }
  else{
      
  }
  delay(25);
}

Credits

devkopunec

devkopunec

1 project • 2 followers

Comments