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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 30:0027d243841b
- Parent:
- 29:f2c9d4570902
- Child:
- 31:adfe162a58a4
--- a/main.cpp Tue Sep 08 14:57:40 2020 +0000 +++ b/main.cpp Wed Sep 09 13:10:07 2020 +0000 @@ -1,28 +1,70 @@ #include "mbed.h" // c'est la bibliothèque -DigitalOut Led_rouge(LED1); -DigitalIn BP2 (PTC6); -DigitalOut Led_verte(LED2); -DigitalIn BP3 (PTA4); +DigitalOut LEDB(LED3); +DigitalOut LEDR(LED1); +DigitalOut LEDV(LED2); +DigitalIn BP1(D3); +DigitalIn BP2(PTC6); +DigitalIn BP3(PTA4); + int main() { while(1) { // c'est la boucle - if (BP2==1) // si le BP2 est appuyé + if (!BP1&&BP2&&BP3) // si le BP2 est appuyé + { + LEDB=1; + LEDR=1; + LEDV=1; + } + + if (!BP1&&!BP2&&BP3) // si le BP2 est appuyé + { + LEDB=0; + LEDR=1; + LEDV=1; + } + + if (!BP1&&BP2&&!BP3) // si le BP2 est appuyé + { + LEDB=1; + LEDR=1; + LEDV=0; + } + + if (!BP1&&!BP2&&!BP3) // si le BP2 est appuyé { - Led_rouge=1; // on éteint la led rouge - } - else // sinon - { - Led_rouge=0; // on allume la led rouge - } - if (BP3==1) // si le BP2 est appuyé + LEDB=1; + LEDR=0; + LEDV=1; + } + + if (BP1&&BP2&&BP3) // si le BP2 est appuyé + { + LEDB=0; + LEDR=1; + LEDV=0; + } + + if (BP1&&!BP2&&BP3) // si le BP2 est appuyé { - Led_verte=1; // on éteint la led verte - } - else // sinon - { - Led_verte=0; // on allume la led verte - } - + LEDB=0; + LEDR=0; + LEDV=1; + } + + if (BP1&&BP2&&!BP3) // si le BP2 est appuyé + { + LEDB=1; + LEDR=0; + LEDV=0; + } + + if (BP1&&!BP2&&!BP3) // si le BP2 est appuyé + { + LEDB=0; + LEDR=0; + LEDV=0; + } + } // fin boucle infinie } // fin programme