Echos ASCII message converted to uppercase. Uses toupper function from standard C library.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
CSTritt
Date:
Mon Feb 11 18:51:56 2019 +0000
Parent:
3:041d6aaa4a7b
Commit message:
Initial version. Echos ASCII message, converted to upper case.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Jan 19 19:49:17 2019 +0000
+++ b/main.cpp	Mon Feb 11 18:51:56 2019 +0000
@@ -11,6 +11,7 @@
     Serial port - Data 8 bit, Parity none, Stop 1 bit, Flow control none.
     Baud as specified below.
 */
+#include <cctype>
 #include "mbed.h"
 
 Serial pc(USBTX, USBRX, 9600); // Standard to PC via USB channel.
@@ -21,8 +22,9 @@
 {
     while (true) {
         if (pc.readable()) {
-            char character = (char) pc.getc(); // Get a char from the PC.
-            pc.putc(character); // Send it back to the PC.
+            char myChar = (char) pc.getc(); // Get a char from the PC.            
+            myChar = std::toupper(myChar);
+            pc.putc(myChar); // Send it back to the PC.
             actLED = !actLED; // Toggle the activity LED.
         }
     }