* ECHO communication between Bluetooth and RS232 * Using mBED Landtiger Card

Dependencies:   mbed-src

Fork of HC05_Transparent_mode by Edoardo De Marchi

main.cpp

Committer:
edodm85
Date:
2013-10-18
Revision:
2:f76f36540871
Parent:
1:8c500bcdcbc4
Child:
3:8783bfb5d8fa

File content as of revision 2:f76f36540871:

/*
 * Author: Edoardo De Marchi
 * Date: 02-07-13
 * Notes: HC05 Trasparent Mode
*/

#include "mbed.h"

#define SERIAL_1


Serial pc(USBTX, USBRX);
#ifdef SERIAL_1
Serial blue(p9,p10);          // HC05
#endif
#ifdef SERIAL_2
Serial blue(p13,p14);         // TX = P14  RX = P13
#endif

DigitalOut myled(LED1);
DigitalOut myled4(LED4);


int main() 
{

    blue.baud(9600);
    pc.baud(9600);
    pc.printf("Bluetooth Start\r\n");
    
    // echo back characters and toggle the LED
    while (1) 
    {
        if (blue.readable()) 
        {
            pc.putc(blue.getc());
            myled = !myled;
        }
        if (pc.readable()) 
        {
            blue.putc(pc.getc());
            myled4 = !myled4;
        }
        
    }
}