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.
Revision 0:6d24223c84c7, committed 2018-08-17
- Comitter:
- Nicolas_11
- Date:
- Fri Aug 17 12:43:16 2018 +0000
- Commit message:
- Add debug;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Aug 17 12:43:16 2018 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#define DEBUG 1
+Serial a(USBTX,USBRX);
+int op1;
+int op2;
+int tp;
+float r;
+
+void Debugm(char *s,...){
+ #if DEBUG
+ a.printf(">>>>DEBUG \t ");
+ a.printf(s);
+ #endif
+ }
+
+int main() {
+ a.baud(9600);
+ Debugm("inniciando programa en modo DEBUG\n");
+ while(1)
+ {
+ #if DEBUG
+ Debugm("ingresa N1:\n");
+ #endif
+ op1=a.getc();
+ #if DEBUG
+ Debugm("ingresa N2:\n");
+ #endif
+ op2=a.getc();
+ #if DEBUG
+ Debugm("ingresa OP:\n");
+ #endif
+ tp=a.getc();
+ switch(tp){
+ case 1:r=op1*op2;
+ #if DEBUG
+ Debugm("Respuesta =:%f\n",r);
+
+ #endif
+ break;
+ case 2:r=op1/op2;
+ #if DEBUG
+ Debugm("Respuesta =:%f \n",r);
+ #endif
+ break;
+ case 3:r=op1+op2;
+ #if DEBUG
+ Debugm("Respuesta =:%f\n",r);
+ #endif
+ break;
+ case 4:r=op1-op2;
+ #if DEBUG
+ Debugm("Respuesta =:%f\n",r);
+ #endif
+ break;
+ default:
+ #if DEBUG
+ Debugm("error de operación =:%f\n",tp);
+ #endif
+ break;
+ }
+ a.printf("%f \n", r);
+
+
+}
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Aug 17 12:43:16 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file