library to modify and read program variable in runtime from a serial console. You can reset as well the mbed from the console without pushing buttons. Handy for debugging from the online compiler as you can change the behavior of the program without need to recompile each time.

Revision:
9:d081aa4e4418
Parent:
8:934ec53fe2c0
Child:
10:34d368966675
--- a/VarStore.cpp	Mon Aug 25 19:54:12 2014 +0000
+++ b/VarStore.cpp	Mon Aug 25 20:44:39 2014 +0000
@@ -99,25 +99,11 @@
 
 char*  VarStore::Get(char *Name)
 {
-    char b[100];
     VarItem *V;
     V=GetVar(Name);
-    VarStore::MyThis->pc->puts(" antes de dump ");
-    sprintf(b," %s %d %d %d \n",
-        V->VarName,*V->ValInt,V->VarType,V->ArraySize);
-       
-    VarStore::MyThis->pc->puts(b);
-     V->Dump();
-    
-  //  char VarName[VAR_NAME_LEN];
-
-  //  int   *ValInt;
-  //  float *ValFloat;
-  //  VarTypes VarType;
-  //  unsigned int ArraySize;
- //   if(V!=NULL) return V->Dump();
- //   else
-     VarStore::MyThis->pc->puts(" despues de dump ");
+    if(V!=NULL)
+     return V->Dump();
+    else
         return NULL;
 }
 
@@ -197,14 +183,17 @@
                 return VarStore::MyThis->Set(str);
             case 'd':
 
+                VarStore::MyThis->pc->puts(str);
+                VarStore::MyThis->pc->putc('\n');
+                
                 ret=strtok(str,":");
                 ret=strtok(NULL,":");
                 
                 ret=VarStore::MyThis->Get(ret);
              
                 if(ret!=NULL) {
-                  //  cuidado puts VarStore::MyThis->pc->printf("%s (%s)\n",str,ret);
-                  VarStore::MyThis->pc->puts("el del mostrar variable");
+                  VarStore::MyThis->pc->puts(ret);
+                  VarStore::MyThis->pc->putc('\n');
                     return ret;
                 } else
                     return NULL;