Author | Rob Jansen, Copyright © 2021..2021, all rights reserved. |
Adapted-by | |
Compiler | 2.5r5 |
JAL library for use of the Bluetooth HC-06 module.
Bluetooth HC-06 Module Datasheet revision 2.2 (2011/04/06) Guangzhou HC Information Technology Co., Ltd.
The default serial interface of the HC-06 is 9600 baud, 1 stopbit, no parity and no flowcontrol. At least one of the JAL serial hardware libraries must be included and initialized by the main program with these settings.
No dependency found
const byte BLUETOOTH_HC06_BAUDRATE_1200 = 1
const byte BLUETOOTH_HC06_BAUDRATE_2400 = 2
const byte BLUETOOTH_HC06_BAUDRATE_115200 = 8
const byte BLUETOOTH_HC06_BAUDRATE_230400 = 9
const byte BLUETOOTH_HC06_BAUDRATE_19200 = 5
const byte BLUETOOTH_HC06_BAUDRATE_38400 = 6
const byte BLUETOOTH_HC06_BAUDRATE_9600 = 4
const byte BLUETOOTH_HC06_BAUDRATE_4800 = 3
const byte BLUETOOTH_HC06_BAUDRATE_57600 = 7
bluetooth_hc06_set_device_pin(byte in pincode[]) return bit
bluetooth_hc06_available() return bit
bluetooth_hc06_data_available() return bit
bluetooth_hc06_data'get() return byte
bluetooth_hc06_set_baudrate(byte in baudrate) return bit
bluetooth_hc06_set_device_name(byte in name[]) return bit
bluetooth_hc06_send_command(byte in command[]) return bit
bluetooth_hc06_data_ready() return bit
_bluetooth_hc06_wait_and_parse_response(byte in token[]) return bit
_bluetooth_hc06_acknowledge() return bit
const byte BLUETOOTH_HC06_BAUDRATE_1200 = 1
Baudrate definitions. Default baudrate of the HC-06 module is 9600 baud.
const byte BLUETOOTH_HC06_BAUDRATE_2400 = 2
No documentation found
const byte BLUETOOTH_HC06_BAUDRATE_115200 = 8
No documentation found
const byte BLUETOOTH_HC06_BAUDRATE_230400 = 9
Not supported by FW DX_Smartv2.0
const byte BLUETOOTH_HC06_BAUDRATE_19200 = 5
No documentation found
const byte BLUETOOTH_HC06_BAUDRATE_38400 = 6
No documentation found
const byte BLUETOOTH_HC06_BAUDRATE_9600 = 4
No documentation found
const byte BLUETOOTH_HC06_BAUDRATE_4800 = 3
No documentation found
const byte BLUETOOTH_HC06_BAUDRATE_57600 = 7
No documentation found
bluetooth_hc06_data'put(byte in data)
Pseudo variable to send data to the module. Wait for the serial interface to be ready and send a data byte. Note that this is a blocking call until the previous byte is transmitted.
bluetooth_hc06_init()
Initialize the module. This is the same as resetting the module.
_bluetooth_hc06_flush_serial_receive_buffer()
Flush the serial receive buffer of the module.
_bluetooth_hc06_send_string(byte in string[])
Sends the given string to the module over the serial interface.
bluetooth_hc06_set_device_pin(byte in pincode[]) return bit
Set the device pincode. The pincode must be 4 characters. Returns TRUE when succesful. The default factory pin is "1234".
bluetooth_hc06_available() return bit
Returns TRUE if the module is responding, otherwise FALSE is returned. When the module is connected to the host the response will also be FALSE.
bluetooth_hc06_data_available() return bit
Returns TRUE if data is received from the module. Data can then be obluetoothained by reading from the variable 'bluetooth_hc06_data'.
bluetooth_hc06_data'get() return byte
Pseudo variable to receive data from the module. Wait for a data byte from the module and return it. Note that this is a blocking call until data is received.
bluetooth_hc06_set_baudrate(byte in baudrate) return bit
Set the baudrate of the module and the baudrate of the serial interface connected to the module. Returns TRUE when succesful. Note: The baudrate changes after a new power up of the module. Make sure that the baudrate of the PIC is also changed to this new baudrate after power up.
bluetooth_hc06_set_device_name(byte in name[]) return bit
Set the device name. The device name may not be longer than 20 characters. Returns TRUE when succcesful.
bluetooth_hc06_send_command(byte in command[]) return bit
Send a command to the module and return TRUE when succesful. This function can be used if the firmware of the module uses commands not supported by this library.
bluetooth_hc06_data_ready() return bit
Returns TRUE when data can be sent to the module. The data can then be sent by writing to the variable 'bluetooth_hc06_data'.
_bluetooth_hc06_wait_and_parse_response(byte in token[]) return bit
Wait for data from the module and parse it. Returns TRUE if the given string token if found. After that it flushes the receive buffer.
_bluetooth_hc06_acknowledge() return bit
Check for an acknowledge of the last sent command and return TRUE when it was received. This can can only be done once, successive calls will return FALSE.
16f15325 | 16f15325_bluetooth_hc06_slave.jal |
16f1823 | 16f1823_bluetooth_hc06_slave.jal |
16f877a | 16f877a_bluetooth_hc06_slave.jal |