Proyecto que lee un buffer de la entrada y lo manda por el serial

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jvicente
Date:
Tue Oct 15 15:09:15 2019 +0000
Parent:
0:d8bdd80b93fe
Commit message:
cambio delay

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d8bdd80b93fe -r 1895d2877fef main.cpp
--- a/main.cpp	Tue Oct 15 14:21:57 2019 +0000
+++ b/main.cpp	Tue Oct 15 15:09:15 2019 +0000
@@ -1,6 +1,8 @@
 #include "mbed.h"
 #define bufferLength 256
 
+Serial pc(USBTX, USBRX,115200); // tx, rx
+
 AnalogIn analog_value(A0);
 Ticker tMuestrea;
 int flag=0;
@@ -10,16 +12,17 @@
 
 int main()
 {
+    
     tMuestrea.attach(&muestrea, 0.001);
     printf("\nAnalogIn example\n");
     while(1) {
         if (flag) {
             for (int n=0; n<bufferLength; n++) {
-                printf("%d\n",buffer[n]);
+                pc.printf("%d\n",buffer[n]);
             }
             flag=0;
         }
-        wait(1);
+        wait_us(1);
     }
 }