-
Notifications
You must be signed in to change notification settings - Fork 0
Bluetooth_Lib
Haiqiang Xu edited this page Jun 7, 2018
·
1 revision
This library communicates with the bluetooth (BT) HC-05 (master/slave) or HC-06 (slave only) modules via SoftwareSerial library.
- Begin(long lBauds): starts the communication with the BT module
- SendATCommandHC05(EATCommand command, String sValue): sends AT commands to the HC-05 module. Set KEY pin to HIGH or press the physical button in the module to enter AT mode. Use together with HardwareSerial to debug the responses sent by the module.
- SendATCommandHC06(EATCommand command, String sValue): sends AT commands to the HC-06 module. Use together with HardwareSerial to debug the responses sent by the module.
- DirectReceive(): Reads RAW information from BT module without any processing.
- Receive(): Reads from BT module when message starts with INI_STR_CMD or INI_BYT_CMD character and reads until it founds the END_CMD character. Otherwise, any information received is discarded. Works together with SendCommand() to establish an own protocol that filters any undesired information like interferences. Use ProcessArrayBytesCommand() or ProcessStringCommand() to retrieve the body of the received message.
- Send(String sMessage): Sends RAW information to the BT module without any processing, only adding LF or CR + LF when needed.
- SendCommand(String sMessage): Sends to the BT module with INI_STR_CMD at the start and END_CMD at the end of the message. Works together with Receive() to establish an own protocol that filters any undesired information like interferences.
- SendCommand(byte byteX, byte byteY): Sends to the BT module with INI_BYT_CMD at the start and END_CMD at the end of the message. Works together with Receive() to establish an own protocol that filters any undesired information like interferences.
- CommandType(String sCommand): helper method that distinguishes if the received message is with INI_STR_CMD or with INI_BYT_CMD.
- ProcessArrayBytesCommand(String sCommand): Returns the body of the message without the INI_BYT_CMD and END_CMD flags into an 2D-array of bytes.
- ProcessStringCommand(String sCommand): Returns the body of the message without the INI_STR_CMD and END_CMD flags into a String.
Please, feel free to add any question or bug here
External Libraries