Jair Valdovinos
/
P3_EJ4
MADE IN RUSSIA
Diff: main.cpp
- Revision:
- 26:e119deab8c39
- Parent:
- 25:c4eed8baa6d3
- Child:
- 27:d87618a1d7e0
--- a/main.cpp Thu Apr 02 00:31:09 2020 +0000 +++ b/main.cpp Sat Apr 11 01:41:26 2020 +0000 @@ -1,24 +1,68 @@ -#include "mbed.h" //libreria que nos permite utilizar comandos y sentencias propias de mbed +#include "mbed.h" + +Serial contador(USBTX, USBRX); -//programa que genera una función sin argumentos y sin retorno de valor +DigitalIn botom(PTA4); +DigitalOut L1(LED1); +DigitalOut L2(LED2); +DigitalOut L3(LED3); -Serial com1(USBTX, USBRX); - - void mensaje(void); //declaración de funcion - //El primer void representa ... el tipo de funcion, en este caso tenemos una funcion void por lo tanto no esperamos un retorno de valor - //El segundo void representa ... el tipo de variable, en este caso tenemos variables void por lo tanto no debemos ingresar valor - - - int main() - { - mensaje(); - - } - -void mensaje(void) -{ while(1) - { - com1.printf("Hola mundo \n"); - wait(1); - } -} \ No newline at end of file +int main () +{ + while ( 1 ) + { + if (botom ==1) + { + L1 = 0; + L2 = 0; + L3 = 0; + wait(1); + L1 = 1; + L2 = 0; + L3 = 0; + wait(1); + L1 = 0; + L2 = 1; + L3 = 0; + wait(1); + L1 = 1; + L2 = 1; + L3 = 0; + wait(1); + L1 = 0; + L2 = 0; + L3 = 1; + wait(1); + L1 = 1; + L2 = 0; + L3 = 1; + + } + else{ + botom==0; + L1 = 1; + L2 = 0; + L3 = 1; + wait(1); + L1 = 0; + L2 = 0; + L3 = 1; + wait(1); + L1 = 1; + L2 = 1; + L3 = 0; + wait(1); + L1 = 0; + L2 = 1; + L3 = 0; + wait(1); + L1 = 1; + L2 = 0; + L3 = 0; + wait(1); + L1 = 0; + L2 = 0; + L3 = 0; + } + } +}