mbed_bot

Dependencies:   mbed

main.cpp

Committer:
jasonberry
Date:
2021-02-25
Revision:
0:d44946656cbe
Child:
1:dfc4375f3eb5

File content as of revision 0:d44946656cbe:

#include "mbed.h"

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

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


int main() 
{

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