BT RFComm Sample Programs

This section descriptions of the how to use sample programs and electric circuit. When you execute sample program, need to set up of that installing some packages, pairing bluetooth device, and more in advance.

And you need to set up of the following items by using Haruzira.
①Add some remote devices for connecting on the manage of remote devices page.
②Add some remote voice commands on the manage of remote voice commands page.
※You can import the following sample data file at each page.
(note: you need to edit of the devices data, match in your environment.)
 - Remote Devices data: HzClientDevicesDemo.json
 - Remote Voice Commands data: HzRemoteVoiceCommandsDemo.json

 

Sample program sources by using Bluetooth RFComm

 

Example 1

bt_console_sample.py is a python file in case of not using electric circuit.

You can control the following commands on the console menu.

・Start of voice recognition

・Send of user command

・Lock of remote operation

 

Example of execute for program.

python3 bt_console_sample.py

 

You must to modify line numbers of 44, 45 in this file for your environment before startup.
port = 1 #Your bluetooth channel (server – working for Haruzira)
host = “XX:XX:XX:XX:XX:XX” #Your bluetooth device address (server – working for Haruzira)

 

Example 2

bt_rfcomm_sample.py is a python file in case of using electric circuit.

You can control the following commands by using the electric circuit.

・Button(blue): Start of voice recognition

・Button(orange): Send of user command

・Button(yellow): Lock of remote operation

Incidentally, A LED is lighted on while it connects to Haruzira by bluetooth, and it is lighted off when disconnect.

 

You must to modify line numbers of 22, 23 in this file for your environment before startup.
port = 1 #Your bluetooth channel (server – working for Haruzira)
host = “XX:XX:XX:XX:XX:XX” #Your bluetooth device address (server – working for Haruzira)

 

Wiring Diagram

 

 

 

 

 

 

Circuit Diagram