예제7) 블루투스 모듈 이름 변경

Dependencies:   mbed-src

Fork of HC-05_S2B_HelloWorld_WIZwiki-W7500 by WIZnet

main.cpp

Committer:
robertchoi
Date:
2017-10-17
Revision:
1:b976dec64b41
Parent:
0:a4c1f76c9564

File content as of revision 1:b976dec64b41:

#include "mbed.h"

Serial pc(USBTX, USBRX);
Serial bt(D1, D0);

int main(void)
{
    char ch;
    pc.baud(9600);
    bt.baud(9600);
    pc.printf("Hello World! HC-06 bluetooth example...\n\r");
    
    while(1)
    {
        if(bt.readable())
        {
            ch=bt.getc();
            pc.printf("%c",ch);
        }
        
        else if(pc.readable())
        {
            ch=pc.getc();
            bt.printf("%c",ch);
        }
    }
}