Recepcion por Interrupcion Serial

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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
diff -r 000000000000 -r 6c1c7f430469 main.cpp
--- /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
diff -r 000000000000 -r 6c1c7f430469 mbed.bld
--- /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