Blink LED example for the Multitech mDot. Additionally, has serial comms via USB and RS232.

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Blinks 1 LED while keeping another 2 on. LEDs are on the MTUDK2-ST-MDOT Developer Kit. Has USB and RS232 serial comms.

Files at this revision

API Documentation at this revision

Comitter:
Timsek
Date:
Mon Jun 12 09:24:47 2017 +0000
Parent:
31:6daaaf1a1e07
Commit message:
Added RS232 serial comm + echo typed char back.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6daaaf1a1e07 -r 7c921089af60 main.cpp
--- a/main.cpp	Wed Mar 22 18:46:56 2017 +0000
+++ b/main.cpp	Mon Jun 12 09:24:47 2017 +0000
@@ -1,8 +1,8 @@
 #include "mbed.h"
 
 
-Serial pc(USBTX, USBRX); //9600 baud rate
-
+Serial rs232(PA_2, PA_3);  //9600 baud rate
+Serial mypc(USBTX, USBRX); //9600 baud rate
 
 DigitalOut led1(PA_0); //  MTUDK2-ST-MDOT Developer Kit D3
 DigitalOut led2(PA_1); //  MTUDK2-ST-MDOT Developer Kit D6
@@ -19,7 +19,11 @@
     while (true) {
         led1 = !led1;
         wait(2); //2s
-        pc.printf("Blink! LED is now %d\r\n", led1.read());
+        
+        rs232.printf("Serial:LED is now %d\r\n", led1.read());
+        mypc.printf("USB:I'm  working\r\n");
+        
+        rs232.putc(rs232.getc()); //wait for char from rs232 and echo it back
    }
 }