Versión 1.0 del programa para enviar un comando y recibir una respuesta del módulo STX3

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
Sumobot
Date:
Sat Oct 21 18:29:14 2017 +0000
Commit message:
Versi?n 1.0 del programa para enviar un comando y recibir una respuesta del m?dulo STX3

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib 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 5c60e855af70 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 21 18:29:14 2017 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+#include "rtos.h"
+
+Serial pc(USBTX, USBRX, 9600); // tx, rx
+Serial device(p9, p10, 9600);  // tx, rx
+DigitalOut RTS(p5);
+InterruptIn CTS(p6);
+Thread thread; 
+
+
+void stx3() {              
+    pc.putc(device.getc());
+}
+
+void cts() {             
+    Thread::wait(5);
+    pc.printf("El valor de CTS es %f\n\r", CTS.read());
+    device.putc(0XAA);
+    device.putc(0X05);
+    device.putc(0X01);
+    device.putc(0X50);
+    device.putc(0XD5);
+    RTS=1;
+}
+
+int main() {
+    pc.printf("Hello World");
+    RTS=1;
+    thread.start(stx3);                  
+    while(1) {
+        Thread::wait(9000);
+        pc.printf("El valor de CTS es %f\n\r", CTS.read());
+        RTS=0;
+        CTS.fall(&cts);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 5c60e855af70 mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Sat Oct 21 18:29:14 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#5713cbbdb706
diff -r 000000000000 -r 5c60e855af70 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 21 18:29:14 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b484a57bc302
\ No newline at end of file