mbed_bot

Dependencies:   mbed

Committer:
jasonberry
Date:
Thu Feb 25 13:22:04 2021 +0000
Revision:
0:d44946656cbe
Child:
1:dfc4375f3eb5
mbed_bot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jasonberry 0:d44946656cbe 1 #include "mbed.h"
jasonberry 0:d44946656cbe 2
jasonberry 0:d44946656cbe 3 Serial pc(USBTX, USBRX);
jasonberry 0:d44946656cbe 4 Serial blue(p9, p10); // TX, RX
jasonberry 0:d44946656cbe 5
jasonberry 0:d44946656cbe 6 DigitalOut myled(LED1);
jasonberry 0:d44946656cbe 7 DigitalOut myled2(LED2);
jasonberry 0:d44946656cbe 8 DigitalOut myled4(LED4);
jasonberry 0:d44946656cbe 9
jasonberry 0:d44946656cbe 10
jasonberry 0:d44946656cbe 11 int main()
jasonberry 0:d44946656cbe 12 {
jasonberry 0:d44946656cbe 13
jasonberry 0:d44946656cbe 14 blue.baud(9600);
jasonberry 0:d44946656cbe 15 pc.baud(115200);
jasonberry 0:d44946656cbe 16 pc.printf("Bluetooth Start\r\n");
jasonberry 0:d44946656cbe 17 blue.printf("Bluetooth Start\r\n");
jasonberry 0:d44946656cbe 18
jasonberry 0:d44946656cbe 19 // echo back characters and toggle the LED
jasonberry 0:d44946656cbe 20 while (1)
jasonberry 0:d44946656cbe 21 {
jasonberry 0:d44946656cbe 22 myled2 = !myled2;
jasonberry 0:d44946656cbe 23 if (blue.readable())
jasonberry 0:d44946656cbe 24 {
jasonberry 0:d44946656cbe 25 pc.putc(blue.getc());
jasonberry 0:d44946656cbe 26 myled = !myled;
jasonberry 0:d44946656cbe 27 }
jasonberry 0:d44946656cbe 28 if (pc.readable())
jasonberry 0:d44946656cbe 29 {
jasonberry 0:d44946656cbe 30 blue.putc(pc.getc());
jasonberry 0:d44946656cbe 31 myled4 = !myled4;
jasonberry 0:d44946656cbe 32 }
jasonberry 0:d44946656cbe 33
jasonberry 0:d44946656cbe 34 }
jasonberry 0:d44946656cbe 35 }