Luke Pell / Mbed 2 deprecated HC05

Dependencies:   mbed

main.cpp

Committer:
lmpell
Date:
2018-03-19
Revision:
0:f6a134626fae

File content as of revision 0:f6a134626fae:

#include "mbed.h"

Serial pc(USBTX, USBRX );

Serial blue(PTC15, PTC14); //tx, rx



int main()
{
    int i = 0;
    pc.baud(9600);                      //setting pc baud rate to 9600
    pc.printf("Enter AT Command\n");    //displaying to terminal
    blue.baud(38400);                   //setting bluetooth baud rate to 38400
    
    while (true) {
            
        //while pc is sending data
        while(pc.readable())             
        {
            //send data to bluetooth device
            blue.putc(pc.getc());
        }
        //while bluetooth device is sending data
        while(blue.readable())
        {
            //send data to pc
            pc.putc(blue.getc());
        }
    }
}