Latest Bluetooth transmission from mbedLPC1768 & HP-05 working with android phone

Dependencies:   mbed

main.cpp

Committer:
parthchandak02
Date:
2018-03-31
Revision:
0:2df416fa994c

File content as of revision 0:2df416fa994c:

#include "mbed.h"

Serial pc(USBTX, USBRX);
Serial blue(p9, p10);          // TX, RX

DigitalOut pcLED(LED1);
DigitalOut blueLED(LED4);

int main()
{
    pc.baud(9600);
    blue.baud(9600);
 
//    blue.printf("\n\nBluetooth Communication Stared!\n\n");
    
    int x = 0;
    while(1)
    {
        if(pc.readable())
        {
            pcLED = !pcLED;
        }
        if(blue.readable())
        {
            blueLED = !blueLED;
            pc.printf("Read character %c\n",blue.getc());  
        }
        
        pc.printf("Printing to serial: %d\n",x);
        blue.printf("Printing to blue: %d\n",x);
        
        x+=1;
        
        wait(0.5);
    }    
}