Interactive serial interface for sending commands to an embedded system using serial communications. This will be helpful if you want to send commands to serial port and be able to correct the wrong text entered at the terminal

Dependencies:   mbed

Revision:
2:880559109781
Parent:
1:e71563467f24
Child:
3:12840abcee40
--- a/main.cpp	Wed Jun 07 06:10:58 2017 +0000
+++ b/main.cpp	Wed Sep 20 05:38:55 2017 +0000
@@ -4,7 +4,7 @@
     This function will take a string from the terminal and save it in a buffer. 
     The string is editable during the time user input the string.
     This will be useful if any one want to have an interactive interface for an application.
-    USE ON YOUR RESPONSIBILITY .. NO WARANTY .. FREE SOFTWARE
+    USE IT AT YOUR OWN RESPONSIBILITY .. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
 
 */
 
@@ -29,13 +29,19 @@
         if(stringBuf[i]=='\b') {
             pc.puts("\b \b");
             stringBuf[i]='\0';
+             if (i>0){
             i--;
+            }
             stringBuf[i]='\0';
+            if (i>0){
             i--;
+            }
+            
         } else {
             pc.putc(stringBuf[i]);
+            i++;
         }
-        i++;
+        
     }
 }
 int main()