Component: Bluetooth (EB024, Generic AT) (Wireless): Difference between revisions
No edit summary |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 190: | Line 190: | ||
===CreateCommand=== | ===CreateCommand=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 209: | Line 209: | ||
===CreateCommandString=== | ===CreateCommandString=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 228: | Line 228: | ||
===Initialise=== | ===Initialise=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 242: | Line 242: | ||
===SendCommand=== | ===SendCommand=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 266: | Line 266: | ||
===SendScript=== | ===SendScript=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 285: | Line 285: | ||
===Send_byte=== | ===Send_byte=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 304: | Line 304: | ||
===StringRead=== | ===StringRead=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 323: | Line 323: | ||
===StringReceive=== | ===StringReceive=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 337: | Line 337: | ||
===WaitForResponse=== | ===WaitForResponse=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | 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 362: | Line 362: | ||
==Property reference== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| Line 388: | Line 388: | ||
| colspan="2" | Data to send for script 0, each command should be terminated with a carriage return | | colspan="2" | Data to send for script 0, each command should be terminated with a carriage return | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 422: | Line 422: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:37, 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

