Yosef Guevara Salamanca
/
STM32_Button_Interrupt
Ejemplo Debug con calculadora
Revision 0:8f1d60cec8c3, committed 2018-08-17
- Comitter:
- djinn77
- Date:
- Fri Aug 17 12:43:47 2018 +0000
- Commit message:
- Adici?n c?digo 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 |
diff -r 000000000000 -r 8f1d60cec8c3 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Aug 17 12:43:47 2018 +0000 @@ -0,0 +1,76 @@ +#include "mbed.h" +#define DEBUG 1 + + +Serial pc(USBTX,USBRX); + +//void f_r(int N){ + + + //char c = N/100; + //char d = (N-c*100)/10; + //char u = (N-c*100-d*10); + + //pc.putc(c+0x30); + //pc.putc(d+0x30); + //pc.putc(u+0x30); + + + + //} + +void debuging(char*s,...){ + + #if DEBUG + pc.printf(s); + #endif + + } + +void main() { + + pc.baud(38400); + + + char op1; + char op2; + char tp; + int rest; + + + while(1){ + debuging("\n Ingrese el valor 1. "); + op1=pc.getc(); + debuging("\n Ingrese el valor 2. "); + op2=pc.getc(); + debuging("\n Ingrese la operacion. "); + tp=pc.getc(); + + switch(tp){ + case 1: + rest= op1*op2; + break; + case 2: + rest= op1/op2; + break; + case 3: + rest= op1+op2; + break; + case 4: + rest= op1-op2; + break; + default: + pc.putc('E'); + break; + + } + debuging("\n El resultado es. "); + pc.printf("%d",rest); + + + } + + +} + +
diff -r 000000000000 -r 8f1d60cec8c3 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Aug 17 12:43:47 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file