Component: Bluetooth (EB024, Generic AT) (Wireless): Difference between revisions
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;"" to "width="10%" align="center" class="mtx-class-macrohead"" |
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"" |
||
| Line 193: | Line 193: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CreateCommand''' | ||
|- | |- | ||
| colspan="2" | Adds a single characters to the end of the Command buffer. Returns 1 for success in adding the characters to the buffer. Returns 0 for errors, including Buffer overflow. | | colspan="2" | Adds a single characters to the end of the Command buffer. Returns 1 for success in adding the characters to the buffer. Returns 0 for errors, including Buffer overflow. | ||
| Line 212: | Line 212: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CreateCommandString''' | ||
|- | |- | ||
| colspan="2" | Assigns a string of characters to the Command buffer. Returns 1 for success in adding the characters to the buffer. Returns 0 for errors, including Buffer overflow. | | colspan="2" | Assigns a string of characters to the Command buffer. Returns 1 for success in adding the characters to the buffer. Returns 0 for errors, including Buffer overflow. | ||
| Line 231: | Line 231: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Required to be used whenever the Bluetooth component is used in a program. Initialises the Bluetooth component ready for use. | | colspan="2" | Required to be used whenever the Bluetooth component is used in a program. Initialises the Bluetooth component ready for use. | ||
| Line 245: | Line 245: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SendCommand''' | ||
|- | |- | ||
| colspan="2" | Sends the command buffer. Returns 1 for success in sending the command. Returns 0 for errors. | | colspan="2" | Sends the command buffer. Returns 1 for success in sending the command. Returns 0 for errors. | ||
| Line 269: | Line 269: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SendScript''' | ||
|- | |- | ||
| colspan="2" | Sends Script idx Note that the general property Number of Scripts needs to be set so that it allows the scripts to be accessed and sent. Returns 0 for success and 1 for error | | colspan="2" | Sends Script idx Note that the general property Number of Scripts needs to be set so that it allows the scripts to be accessed and sent. Returns 0 for success and 1 for error | ||
| Line 288: | Line 288: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Send_byte''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 307: | Line 307: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''StringRead''' | ||
|- | |- | ||
| colspan="2" | Returns the ASCII value of character idx of the Response string. | | colspan="2" | Returns the ASCII value of character idx of the Response string. | ||
| Line 326: | Line 326: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''StringReceive''' | ||
|- | |- | ||
| colspan="2" | Checks for a response string. Returns the length of the response string if one is present otherwise returns 0. | | colspan="2" | Checks for a response string. Returns the length of the response string if one is present otherwise returns 0. | ||
| Line 340: | Line 340: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WaitForResponse''' | ||
|- | |- | ||
| colspan="2" | Waits for a response message of type response_code for timeout ms. Returns: 0 for a Response of type response_code 255 (0xFF) for a timeout or invalid response Response string length for any Response not of type response_code | | colspan="2" | Waits for a response message of type response_code for timeout ms. Returns: 0 for a Response of type response_code 255 (0xFF) for a timeout or invalid response Response string length for any Response not of type response_code | ||
| Line 365: | Line 365: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
Revision as of 14:23, 13 July 2026
| Author | Matrix Ltd. |
| Version | 2.0 |
| Category | Wireless |
Bluetooth (EB024, Generic AT) component
Low level routines for controlling a standard AT Bluetooth interface. Also available in the form of the EB024 Bluetooth E-block.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Bluetooth.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Bluetooth.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Making a device discoverable
Example program to set up the Bluetooth module to be discoverable with a pair key. Any data received is then output onto the LCD component. You can connect to the Bluetooth device using a PC with Bluetooth connection and using software such as Flowcode 6, RealTerm or HyperTerminal. Alternatively you can connect using a smart phone running a terminal emulator app or via another embedded Bluetooth board.
Bluetooth Discover
Script 1 contains the AT commands to setup the Bluetooth device to be discoverable with pair key "1234".
Searching for a device
Example program to scan for local discoverable Bluetooth devices. For each device found the MAC address is displayed on to the LCD.
Bluetooth Inquiry
Connecting to a device
Example program to connect to a specific Bluetooth device address and send data to the device.
Bluetooth Connect
The device MAC address is specified using the "CreateCommandString" and "SendCommand" macros.
Macro reference
CreateCommand
CreateCommandString
Initialise
| Initialise | |
| Required to be used whenever the Bluetooth component is used in a program. Initialises the Bluetooth component ready for use. | |
| Return | |
SendCommand
SendScript
Send_byte
| Send_byte | |
| ByteVal | |
| Return | |
StringRead
StringReceive
| StringReceive | |
| Checks for a response string. Returns the length of the response string if one is present otherwise returns 0. | |
| Return | |
WaitForResponse

