Frank Girald
/
interruptRX
Recepcion por Interrupcion Serial
Revision 0:6c1c7f430469, committed 2017-05-08
- Comitter:
- franni
- Date:
- Mon May 08 22:14:54 2017 +0000
- Commit message:
- Interrupcion Serial Recepcion
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 Mon May 08 22:14:54 2017 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" + +DigitalOut led_r(LED2); +DigitalOut led_b(LED3); +DigitalOut led_g(LED1); + + +Serial rs232(USBTX,USBRX); + +void int_rx() +{ + int datoin = rs232.getc(); + + switch (datoin) { + + + case 'r': + led_r=1; + led_g=0; + led_b=0; + + break; + + case 'g': + led_r=0; + led_g=1; + led_b=0; + + break; + + case 'b': + led_r=0; + led_g=0; + led_b=1; + + break; + + default: + + break; + + } +} + +int main() +{ + rs232.baud(9600); + rs232.attach(&int_rx); + while(1) {} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 08 22:14:54 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/794e51388b66 \ No newline at end of file