3.6 Bluetooth Control (Bluetooth Classic)
A. Learning Objectives
- understand the working principles of Bluetooth;
- use a Bluetooth terminal app by Android phone;
- write a program in D1 R32 to communicate with an Android phone via Bluetooth.
B. Notes
B1. Introduction of Bluetooth
C. Coursework
C1: SEND MESSAGES TO ANDROID PHONE (5 marks)
Step 1: Install an Android Terminal App:
Link: Serial Bluetooth Terminal
Step 2: Write an AnduinoBlocks Program:
Create, upload and run the following program to send messages repeatedly from your Wemos D1 R32 board.
Step 3: Match the Wemos D1 R32 boardto your Android Phone in the phone setting of Bluetooth.
The Bluetooth device name is what you inputted in your ArduinoBlocks program, e.g. "3A99".
Step 4: Use Serial Bluetooth Terminal to connect to your Wemos D1 R32 board.
C2: RECEIVE MESSAGES FROM ANDROID PHONE
Step 1: Install an Android Terminal App:
Link: Serial Bluetooth Terminal
Step 2: Write an AnduinoBlocks Program:
Create, upload and run the following program to send messages repeatedly from your Wemos D1 R32 board.

- command equals "___" : string comparison
- Write Digital Pin 2 ON/OFF: Turn ON/OFF onboard LED
Step 3: Match the Wemos D1 R32 board to your Android Phone in the phone setting of Bluetooth.
The Bluetooth device name is what you inputted in your ArduinoBlocks program, e.g. "3A99".
Change the settings for "send": Newline-> LF

C3: VOICE CONTROL (optional)
Step 1: Install an Android App "Control por voz".

You can scan the following QR code to download the apk file:
Step 2: Press "Conectar" and select the Wemos D1 R32 board to connect. Press "Desconectado" to disconnect.
Disconnected -> Connected

Step 3: Press the mic icon and speak.
Examples: Say "turn on". Say "turn off"
Step 4: Modify the program to accept the voice commands.
For example:
