Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 27:d87618a1d7e0, committed 2020-04-15
- Comitter:
- thesad
- Date:
- Wed Apr 15 21:43:24 2020 +0000
- Parent:
- 26:e119deab8c39
- Commit message:
- Practica 3 renew;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e119deab8c39 -r d87618a1d7e0 main.cpp
--- 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