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.
Fork of DigitCode by
Revision 2:03518f08ccc0, committed 2015-06-11
- Comitter:
- pierrick
- Date:
- Thu Jun 11 07:50:16 2015 +0000
- Parent:
- 1:0f2ba28c2e70
- Commit message:
- digicode
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 14 08:42:37 2015 +0000 +++ b/main.cpp Thu Jun 11 07:50:16 2015 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" #include "fonction.h" -DigitalOut myled(LED1); -DigitalOut myled2(LED4); -DigitalOut myled3(LED3); +DigitalOut myledred(p21); +DigitalOut myledred2(p22); +DigitalOut myledgreen(p23); BusIn bus(p19, p18,p17,p16,p15,p14,p13,p12,p11,p10,p9,p8); int etat = 0; int code[] = {1, 2, 3, 4}; @@ -16,9 +16,9 @@ n = bitToInt(n); switch (etat) { case ETAT0: - myled = 1; - myled2 = 0; - myled3 = 0; + myledred = 1; + myledred2 = 0; + myledgreen = 0; if (n == code[0] && nPrecedent == -3 ) { etat = NB1; @@ -27,12 +27,12 @@ break; case NB1: - myled = 0; - myled2 = 0; - myled3 = 0; + myledred = 0; + myledred2 = 0; + myledgreen = 0; if (n == code[1] && nPrecedent == -3) { etat = NB2; - myled = 0; + myledred = 0; wait(0.2); } else if (n != -3) etat = ERREUR; @@ -58,13 +58,13 @@ case FINAL: etat = ETAT0; - myled2 = 1; + myledred2 = 1; wait(5); break; case ERREUR: - myled3 = 1; + myledgreen = 1; wait(1); - myled2 = 0; + myledred2 = 0; etat = ETAT0; } printf("etat = %d | n = %d | nPrecedent = %d\n", etat, n, nPrecedent);