Ehhhhhhh

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gabocs
Date:
Tue Nov 05 20:52:30 2019 +0000
Parent:
24:7f14b70fc9ef
Commit message:
sfasf

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7f14b70fc9ef -r 1b4fa82d7fc2 main.cpp
--- a/main.cpp	Mon Apr 08 11:03:25 2019 +0100
+++ b/main.cpp	Tue Nov 05 20:52:30 2019 +0000
@@ -1,12 +1,28 @@
 #include "mbed.h"
-
-DigitalOut myled(LED1);
-
-int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
-}
+Serial pc(USBTX,USBRX);
+AnalogIn pito(PTB2);
+DigitalOut led(PTB22);
+Timer reloj1;
+Ticker reloj2;
+Timer reloj3;
+void destello(){
+    led=!led;}
+int main(){
+int i;
+char cad[4];
+char p1[4];
+pc.printf("Ingrese una palabra de 4 caracteres.\n");
+pc.putc(pc.getc());
+cad[4]=pc.getc();
+srand(pito.read_u16());
+                reloj1.start();
+    reloj2.attach(&destello,10);
+                
+do{
+    for(i=0;i<4;i++){
+    p1[i]=1+rand()%(123-97);}}
+    while(cad[i]!=p1[i]);
+                reloj1.stop();
+    pc.printf("%i\n",p1);
+    pc.printf("El tiempo trasncurrido del proceso fue:%f",reloj1.read());
+}    
\ No newline at end of file