Other Arduino Codes and Videos by Robojax

Arduino code and video HC-06 Bluetooth AC Bulb

دروس آردوینو به فارسی

This is the Arduino code for HC-06 Bluetooth AC bulbe ON/OFF

This video shows you how to use turn ON for OFF AC bulb using your mobile phone and Arduino with HC-06 module. http://robojax.com/learn/arduino/
  1. HC-06 Bluetooth code on GetHub
  2. App 1 used in video: Androied Bluetooth connector
  3. App 2 used in video: Bluetooth Terminal

 * This is the Arduino code for  HC-06 Bluetooth module
 * to measure the distance using arduino for robotoic car and other applications
 * Watch the video https://youtu.be/-E9J9ExdZ20
 *  * 
 * Written by Ahmad Nejrabi for Robojax Video
 * Date: Jan 01, 2018, in Ajax, Ontario, Canada
 * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: this code is "AS IS" and for educational purpose only.

// original source code: https://github.com/tronixlabsAU/HC06
#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); 
// creates a "virtual" serial port/UART
// connect BT module TX to D10
// connect BT module RX to D11
// connect BT Vcc to 5V, GND to GND

#define SW 2 // define pin 2 as control pin
// by Robojax for Robojax.com, Jan 01, 2018
void setup()  
  // set digital pin to control as an output
  pinMode(SW, OUTPUT);

  // set the data rate for the SoftwareSerial port

  // Send test message to other device
  BT.println("Hello from Arduino");

char a; // stores incoming character from other device

void loop() 
  if (BT.available())
  // if text arrived in from BT serial...
    if (a=='1')
      digitalWrite(SW, LOW);// Turn LIGH ON
      BT.println("Light on");
    if (a=='2')
      digitalWrite(SW, HIGH);// Turn LIGHT OFF
      BT.println("Light off");
    if (a=='?')
      BT.println("Send '1' to turn LIGHT on");
      BT.println("Send '2' to turn LIGHT OFF");

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal