Bluetooth connection between a phone and a development board.
Pre Requisites:
Android phone with Bluetooth SPP profile ( Explained in Part 2 )
FRDM-KL25Z Board ( < INR 2000 )
HC 06 Bluetooth Module ( INR 800 )
mbed Compiler ( Free )
Pre Requisites:
Android phone with Bluetooth SPP profile ( Explained in Part 2 )
FRDM-KL25Z Board ( < INR 2000 )
HC 06 Bluetooth Module ( INR 800 )
mbed Compiler ( Free )
Initial Setup:
Just open the mbed compiler and create a skeleton program to get started. Select the appropriate mbed board from the list. The FRDM_KL25z on Freescale has a simple RGB led to play with. Declare the digital pins that control the leds in the beginning of the program.
You get this when a new project is created
// hello.cpp #include "mbed.h"
DigitalOut myled(LED1);
int main()
{
while(1)
{
myled = 1;wait(0.2);
myled = 0;wait(0.2);
}
}
// Comment DigitalOut led1(LED_RED); DigitalOut led2(LED_GREEN); DigitalOut led3(LED_BLUE);
This will allow us to turn the leds on and off using simple statements like
led1 = 1; /* Turn On */ led1 = 0; /* Turn Off */
Familiarity with the mbed compiler is needed to proceed further. Design:
The MBED board is hooked to the BT card via one of the UARTs onboard.
To “activate” the serial driver just add the following lines to the mbed code
Serial bt(PTC4,PTC3);
No date can be tansmitted and received from the BT module by printf scanf getc getch etc
Eg
bt.printf("init");
Implementation:
Next:
Next:
Comments
Post a Comment