hola mundo

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mohamed2011
Date:
Mon Feb 18 16:36:30 2019 +0000
Child:
1:168ef95af03e
Commit message:
ejemplo;

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 Feb 18 16:36:30 2019 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "string.h"
+Serial mi_pc(USBTX, USBRX);
+BusOut leds(LED1, LED2, LED3, LED4);
+DigitalOut myled1(LED1);
+
+DigitalOut myled2(LED4);
+float tiempo = 0.1;
+int i,j;
+float matriz[2][2];//3x3
+char numero[20];
+char nombre[20];
+int main() 
+{
+    mi_pc.printf("Escribe tu nombre \n \r");//enviar datos al puerto serial
+    mi_pc.scanf("%s",&numero);//recibir datos
+    mi_pc.printf("Hola %s \n \r", nombre);
+    wait(5*tiempo);
+    leds = 15;
+    wait(5*tiempo);       
+
+ for(i=0;i<=2;i++) //<--ciclo for
+    {
+    for(j=0;j<=2;j++) //<--ciclo for
+        {
+        mi_pc.printf("dame el numero \n \r");//enviar datos al puerto serial
+        mi_pc.scanf("%d",&numero);//recibir datos
+        matriz[i][j]=atof(numero);
+        mi_pc.printf("%f",matriz[i][j]);
+       
+       }
+    }
+  mi_pc.printf("%d",matriz);
+ /*   while(i>0) //<--while infinito
+    {
+        leds = 1;
+        wait(tiempo);
+        leds = 2;
+        wait(tiempo);
+       leds = 4;
+        wait(tiempo);
+        leds = 8;
+        wait(tiempo);
+        leds = 4;
+        wait(tiempo);
+        leds = 2;
+        wait(tiempo);
+       mi_pc.printf("%d \n\r",--i);
+        // i=i-1; //decrementar i
+       
+       
+       }
+*/       
+       while(true)
+       {
+        //el prgrama no hace nada   
+        }
+       
+       
+       
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 18 16:36:30 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf
\ No newline at end of file