Bluetooth Application Guide

From Flowcode Help
Revision as of 14:30, 29 August 2014 by LeighM (talk | contribs)
Jump to navigationJump to search

Introduction

These examples demonstrate the use of the Flowcode Bluetooth component.

In particular they make use of the EB024 E-blocks Bluetooth board, connected to an EB006 E-blocks PICmicro multiprogrammer fitted with a 16F1937 microprocessor.

However, the examples are easily changed in Flowcode to support other microprocessors and platforms.

The Matrix TSL EB934SI6 Easy Bluetooth bundle has all the items required for these sample applications and is an ideal introduction to Bluetooth technology.


Setting up the project hardware

Connect the E-Blocks as indicated in the table below.

The Bluetooth, LCD and Switch E-Blocks all need to be powered via wire connections to the +V on the EB006.

Hardware Setup
EB006 PICmicro multiprogrammer
EB004 E-blocks LED board Port A
EB005 E-blocks LCD board Port B
EB024 E-blocks Bluetooth board Port C
EB007 E-blocks push-to-make switch board Port D


Example 1: Discoverable USB serial device setup

FC6 Icon.png Discoverable USB Serial Device Setup Example

Example 1 is a simple program that sets up the Bluetooth module by using a script to setup the module as a generic serial communications bus. Once the device has been setup the LCD will display the message OK. When a pair request is received from another Bluetooth device the MAC address of this device is shown on the LCD.

Once the Bluetooth device has been setup to be discoverable and a pairing key has been assigned, this information is stored into the firmware of the Bluetooth module using the AT&w command. For example 1 we show you how to set up these details so that your Bluetooth board is available for use as a serial device. Once this has been done the Bluetooth module will recover these settings every time it is powered on or until it is reprogrammed.

In examples 2 and 3 use the RS232 component to communicate over the Bluetooth serial connection. The RS232 component and the Bluetooth component both use the hardware UART so only one of the components can be connected to a single program.


Example 2: Simple USB serial display device

FC6 Icon.png Simple USB Serial Display Device Example

The example 2 program simply demonstrates an echo function. Any data that is received via the Bluetooth connection to our USB serial display device is passed to the LCD to be printed out as an ASCII character before being also retransmitted back to the sending device.

So we need to setup a PC to communicate with our Simple USB serial display device.