Alyson Castiblanco
/
Nucleo_pwm
:3
Revision 0:2792fd1649c8, committed 2018-08-17
- Comitter:
- acastiblancoc
- Date:
- Fri Aug 17 12:46:01 2018 +0000
- Commit message:
- :3 (>^w^)>
Changed in this revision
NewCalc.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/NewCalc.cpp Fri Aug 17 12:46:01 2018 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" +#define DEBUG 1 +Serial pc(SERIAL_TX,SERIAL_RX); +int op1, op2, tp, r; +void f_p(int n) +{ + int c=n/100; + int d=(n-(c*100))/10; + int u=(n-(c*100)-(d*10)); + pc.putc(c+0x30); + pc.putc(d+0x30); + pc.putc(u+0x30); + } +void debugm(int s) +{ + #if DEBUG + pc.printf("\n%d%",s); + #endif + } + +main() +{ + while(1) + { + op1=pc.getc(); + pc.printf("\nIngrese el primero operador"); + debugm(op1); + + op2=pc.getc(); + pc.printf("\nIngrese el segundo operador"); + debugm(op2); + + tp=pc.getc(); + pc.printf("\nIngrese el numero de la operacion"); + debugm(tp); + + switch(tp) + { + case 1: + r=op1*op2; + break; + + case 2: + r=op1/op2; + break; + + case 3: + r=op1+op2; + break; + + case 4: + r=op1-op2; + break; + } + //f_p(r); + pc.printf("\nEl resultado es.. "); + debugm(r); + } + } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Aug 17 12:46:01 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file