Jair Valdovinos
/
P3_EJ4
MADE IN RUSSIA
Diff: main.cpp
- Revision:
- 27:d87618a1d7e0
- Parent:
- 26:e119deab8c39
--- a/main.cpp Sat Apr 11 01:41:26 2020 +0000 +++ b/main.cpp Wed Apr 15 21:43:24 2020 +0000 @@ -2,67 +2,44 @@ Serial contador(USBTX, USBRX); -DigitalIn botom(PTA4); -DigitalOut L1(LED1); -DigitalOut L2(LED2); -DigitalOut L3(LED3); +DigitalIn botom(PTC4); int main () { + while ( 1 ) { - if (botom ==1) + contador.printf("Presione el botón PTC4\n"); + + if (botom.read()==0) { - 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; - + contador.printf("0 0 0 \n"); + wait(2); + contador.printf("0 0 1 \n"); + wait(2); + contador.printf("0 1 0 \n"); + wait(2); + contador.printf("0 1 1 \n"); + wait(2); + contador.printf("1 0 0 \n"); + wait(2); + contador.printf("1 0 1 \n"); } 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; + contador.printf("1 0 1 \n"); + wait(2); + contador.printf("1 0 1 \n"); + wait(2); + contador.printf("1 0 0 \n"); + wait(2); + contador.printf("0 1 1 \n"); + wait(2); + contador.printf("0 1 0 \n"); + wait(2); + contador.printf("0 0 1 \n"); + wait(2); + contador.printf("0 0 0 \n"); + } } -} +} \ No newline at end of file