![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
hola mundo
main.cpp@1:168ef95af03e, 2019-02-18 (annotated)
- Committer:
- jasalex98
- Date:
- Mon Feb 18 16:50:40 2019 +0000
- Revision:
- 1:168ef95af03e
- Parent:
- 0:3a42b01d4a09
Version 2;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mohamed2011 | 0:3a42b01d4a09 | 1 | #include "mbed.h" |
mohamed2011 | 0:3a42b01d4a09 | 2 | #include "string.h" |
mohamed2011 | 0:3a42b01d4a09 | 3 | Serial mi_pc(USBTX, USBRX); |
mohamed2011 | 0:3a42b01d4a09 | 4 | BusOut leds(LED1, LED2, LED3, LED4); |
mohamed2011 | 0:3a42b01d4a09 | 5 | DigitalOut myled1(LED1); |
mohamed2011 | 0:3a42b01d4a09 | 6 | |
mohamed2011 | 0:3a42b01d4a09 | 7 | DigitalOut myled2(LED4); |
mohamed2011 | 0:3a42b01d4a09 | 8 | float tiempo = 0.1; |
jasalex98 | 1:168ef95af03e | 9 | int i,j,k; |
mohamed2011 | 0:3a42b01d4a09 | 10 | float matriz[2][2];//3x3 |
mohamed2011 | 0:3a42b01d4a09 | 11 | char numero[20]; |
mohamed2011 | 0:3a42b01d4a09 | 12 | char nombre[20]; |
mohamed2011 | 0:3a42b01d4a09 | 13 | int main() |
mohamed2011 | 0:3a42b01d4a09 | 14 | { |
mohamed2011 | 0:3a42b01d4a09 | 15 | mi_pc.printf("Escribe tu nombre \n \r");//enviar datos al puerto serial |
mohamed2011 | 0:3a42b01d4a09 | 16 | mi_pc.scanf("%s",&numero);//recibir datos |
mohamed2011 | 0:3a42b01d4a09 | 17 | mi_pc.printf("Hola %s \n \r", nombre); |
mohamed2011 | 0:3a42b01d4a09 | 18 | wait(5*tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 19 | leds = 15; |
mohamed2011 | 0:3a42b01d4a09 | 20 | wait(5*tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 21 | |
mohamed2011 | 0:3a42b01d4a09 | 22 | for(i=0;i<=2;i++) //<--ciclo for |
mohamed2011 | 0:3a42b01d4a09 | 23 | { |
mohamed2011 | 0:3a42b01d4a09 | 24 | for(j=0;j<=2;j++) //<--ciclo for |
mohamed2011 | 0:3a42b01d4a09 | 25 | { |
mohamed2011 | 0:3a42b01d4a09 | 26 | mi_pc.printf("dame el numero \n \r");//enviar datos al puerto serial |
mohamed2011 | 0:3a42b01d4a09 | 27 | mi_pc.scanf("%d",&numero);//recibir datos |
mohamed2011 | 0:3a42b01d4a09 | 28 | matriz[i][j]=atof(numero); |
mohamed2011 | 0:3a42b01d4a09 | 29 | mi_pc.printf("%f",matriz[i][j]); |
mohamed2011 | 0:3a42b01d4a09 | 30 | |
mohamed2011 | 0:3a42b01d4a09 | 31 | } |
mohamed2011 | 0:3a42b01d4a09 | 32 | } |
mohamed2011 | 0:3a42b01d4a09 | 33 | mi_pc.printf("%d",matriz); |
mohamed2011 | 0:3a42b01d4a09 | 34 | /* while(i>0) //<--while infinito |
mohamed2011 | 0:3a42b01d4a09 | 35 | { |
mohamed2011 | 0:3a42b01d4a09 | 36 | leds = 1; |
mohamed2011 | 0:3a42b01d4a09 | 37 | wait(tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 38 | leds = 2; |
mohamed2011 | 0:3a42b01d4a09 | 39 | wait(tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 40 | leds = 4; |
mohamed2011 | 0:3a42b01d4a09 | 41 | wait(tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 42 | leds = 8; |
mohamed2011 | 0:3a42b01d4a09 | 43 | wait(tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 44 | leds = 4; |
mohamed2011 | 0:3a42b01d4a09 | 45 | wait(tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 46 | leds = 2; |
mohamed2011 | 0:3a42b01d4a09 | 47 | wait(tiempo); |
mohamed2011 | 0:3a42b01d4a09 | 48 | mi_pc.printf("%d \n\r",--i); |
mohamed2011 | 0:3a42b01d4a09 | 49 | // i=i-1; //decrementar i |
mohamed2011 | 0:3a42b01d4a09 | 50 | |
mohamed2011 | 0:3a42b01d4a09 | 51 | |
mohamed2011 | 0:3a42b01d4a09 | 52 | } |
mohamed2011 | 0:3a42b01d4a09 | 53 | */ |
mohamed2011 | 0:3a42b01d4a09 | 54 | while(true) |
mohamed2011 | 0:3a42b01d4a09 | 55 | { |
mohamed2011 | 0:3a42b01d4a09 | 56 | //el prgrama no hace nada |
mohamed2011 | 0:3a42b01d4a09 | 57 | } |
mohamed2011 | 0:3a42b01d4a09 | 58 | |
mohamed2011 | 0:3a42b01d4a09 | 59 | |
mohamed2011 | 0:3a42b01d4a09 | 60 | |
mohamed2011 | 0:3a42b01d4a09 | 61 | } |