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 here.
You will need the following parts:
1x arduino uno
1x arduino USB Cable
7x Jumper Wire
1x LED (any colour)
1x HC-05 Bluetooth module.
I purchased my module from this store.
You can find the green coding blocks under Bluetooth HC-05 at the bottom of your block list
Using the green Start Bluetooth HC-05 block you initialize the Bluetooth
You need to check if the bluetooth is receiving data, using the green HC-05 receiving data block
If you receiving data then you will read the data from the Bluetooth using the read data from HC-05 block.
You will then check if your received character a and then turn ON the LED at pin D5.
You will also check if your received character b and then turn OFF the LED at pin D5.
Down the Android app from here.
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