Rob Toulson / Mbed 2 deprecated PE_12-03_InitailisePairedBluetooth

Dependencies:   mbed

Committer:
robt
Date:
Sun Jun 16 15:29:27 2013 +0000
Revision:
0:0ed449e32cc1
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robt 0:0ed449e32cc1 1 /*Program Example 12.3: function to initialise paired Bluetooth connection with RN-41 modules
robt 0:0ed449e32cc1 2 */
robt 0:0ed449e32cc1 3 void initialise_connection() {
robt 0:0ed449e32cc1 4
robt 0:0ed449e32cc1 5 rn41.putc('$'); // Enter command mode
robt 0:0ed449e32cc1 6 rn41.putc('$'); //
robt 0:0ed449e32cc1 7 rn41.putc('$'); //
robt 0:0ed449e32cc1 8 wait(0.5);
robt 0:0ed449e32cc1 9
robt 0:0ed449e32cc1 10 rn41.putc('C'); //
robt 0:0ed449e32cc1 11 rn41.putc(','); // Send MAC address
robt 0:0ed449e32cc1 12 rn41.putc('0'); //
robt 0:0ed449e32cc1 13 rn41.putc('0'); //
robt 0:0ed449e32cc1 14 rn41.putc('0'); //
robt 0:0ed449e32cc1 15 rn41.putc('6'); //
robt 0:0ed449e32cc1 16 rn41.putc('6'); //
robt 0:0ed449e32cc1 17 rn41.putc('6'); //
robt 0:0ed449e32cc1 18 rn41.putc('0'); //
robt 0:0ed449e32cc1 19 rn41.putc('7'); //
robt 0:0ed449e32cc1 20 rn41.putc('A'); //
robt 0:0ed449e32cc1 21 rn41.putc('C'); //
robt 0:0ed449e32cc1 22 rn41.putc('C'); //
robt 0:0ed449e32cc1 23 rn41.putc('1'); //
robt 0:0ed449e32cc1 24 wait(0.5);
robt 0:0ed449e32cc1 25
robt 0:0ed449e32cc1 26 rn41.putc('-'); // Exit command mode
robt 0:0ed449e32cc1 27 rn41.putc('-'); //
robt 0:0ed449e32cc1 28 rn41.putc('-'); //
robt 0:0ed449e32cc1 29 rn41.putc(0x0D); //
robt 0:0ed449e32cc1 30 wait(0.5);
robt 0:0ed449e32cc1 31 }
robt 0:0ed449e32cc1 32