Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os-example-mbed5-blinky by
Revision 32:7c921089af60, committed 2017-06-12
- 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 | 
--- 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
    }
 }
 
    