🤖
KidsCode
  • Welcome to KidsCode
  • Setting up mBlock
  • Arduino Lessons
    • Arduino Beginner Lessons
      • Blinking an LED
      • LED Switching
      • LED Chasing
      • Traffic Signal
      • Buzzer
      • Buzzer + Push Button
      • LED + Push Button
    • Bluetooth LED
  • Arduino Robot Car
    • Arduino Bluetooth Car
      • What you will need
      • Circuit Diagram
      • Assembly the Car
      • Upload the Code
      • Bluetooth setup and Test
  • Micro:bit Beginners
    • micro:bit, the hardware
    • Overview of MakeCode
    • Video Library
    • Lesson 1
      • My micro:bit
      • Safety first!
      • Plug in your micro:bit
      • My name is?
      • Learning Outcomes
    • Lesson 2
      • Whats your name again?
      • How fast is your heart beat?
    • Lesson 3
      • Please switch on the TV
      • One, Two, Three
      • Keep pressing that buttons
    • Lesson 4
      • Variable, what is that!!
      • Step Counter
      • 1 + 1 = 2
  • Micro:bit Advanced Activities
    • Blinking an LED
    • Traffic Signal
Powered by GitBook
On this page
  • What will we do
  • Parts List
  • Wiring it up
  • mBlock IDE
  • Block Coding
  • Block Coding Explained
  • Testing your code

Was this helpful?

  1. Arduino Lessons

Bluetooth LED

PreviousLED + Push ButtonNextArduino Bluetooth Car

Last updated 4 years ago

Was this helpful?

What will we do

In this lesson we will learn how to switch an LED’s on and off from our Android phone using a bluetooth module.

We will wire up our circuit to include a LED and a Bluetooth module. We will also write some code that will read a character for the Android app that will tell the LED to come on and go off.

we will use character a to turn on the LED and character b to switch off the LED

The Android app can be downloaded .

Please ensure that you have mBlock setup on you computer. Click to setup mBlock

Parts List

You will need the following parts:

  • 1x arduino uno

  • 1x arduino USB Cable

  • 1x Breadboard

  • 7x Jumper Wire

  • 1x LED (any colour)

  • 1x Resistor

  • 1x HC-05 Bluetooth module.

Wiring it up

mBlock IDE

Block Coding

You can find the green coding blocks under Bluetooth HC-05 at the bottom of your block list

Block Coding Explained

  1. Using the green Start Bluetooth HC-05 block you initialize the Bluetooth

  2. You need to check if the bluetooth is receiving data, using the green HC-05 receiving data block

  3. If you receiving data then you will read the data from the Bluetooth using the read data from HC-05 block.

  4. You will then check if your received character a and then turn ON the LED at pin D5.

  5. You will also check if your received character b and then turn OFF the LED at pin D5.

Please remove the green RX jumper from the Arduino board before you upload your code. If the jumper is not removed then you will get an error.

Testing your code

  • Pair the bluetooth with your phone. Search for HC-05 and pair this device. The password will be 1234

  • Open the app and press the Connect button

  • Select HC-05 from the list.

  • Once connected, press the ON button and your LED should light up.

  • Press the OFF button and the LED will go OFF

I purchased my module from this .

Launch the mBlock IDE () and select the Arduino Uno Device and install the

Down the Android app from .

here
here
store
https://ide.mblock.cc/#/
Kids Code Extension
here
Bluetooth Transceiver ModuleRoboFactory
Logo
mBlock Block-Based IDE- Coding for Beginners
Logo