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 Serial_HelloWorld_Mbed by
Revision 5:8bb67df511a3, committed 2014-09-22
- Comitter:
 - andrelongo85
 - Date:
 - Mon Sep 22 06:32:31 2014 +0000
 - Parent:
 - 4:235e50314809
 - Commit message:
 - Comments update
 
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file | 
--- a/main.cpp	Mon Sep 22 06:27:25 2014 +0000
+++ b/main.cpp	Mon Sep 22 06:32:31 2014 +0000
@@ -13,10 +13,6 @@
     for ( int i= (size -1); i >= 0 ; i-- ) {
         tmp = int( tmp + ( ( int(char_p[i]) - 48 ) * pot_ten ));
         pot_ten*=10;
-        //pc.printf("\n");
-        //print_num(tmp);
-        //pc.printf("\n");
-        //print_num(pot_ten);
     }
     return tmp;
 }
@@ -42,6 +38,7 @@
     }
 }
 
+//global variables
 char c;
 char op = '=';
 char operand [100];
@@ -55,8 +52,7 @@
 bool neg_operand = FALSE;
 bool error=FALSE;
 
-
-// serial interrup callback function
+// serial interrupt callback function
 void callback()
 {
     while(1) {
@@ -86,10 +82,10 @@
                 }
 
 
-                if (first) {  //First Operator
+                if (first) {  //First operator
                     result = ioperand;
                     first = FALSE;
-                } else { //Do Calculation
+                } else { //Do calculation
 
                     if(op == '+') {
                         result = int (result + ioperand);
@@ -125,7 +121,7 @@
                         error = FALSE;
                     }
                 }
-                op = c;  // assign the Operator
+                op = c;  // assign the operator
                 index=0; // reset the operand
                 sign_check = TRUE; // sign check activated
                 neg_operand=FALSE;
@@ -146,6 +142,7 @@
     }
 }
 
+// MAIN
 int main()
 {
     pc.attach(&callback,Serial::RxIrq);
    