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 1:9a79c225efd9, committed 2020-09-28
- Comitter:
- riziki_rascol
- Date:
- Mon Sep 28 10:08:51 2020 +0000
- Parent:
- 0:a7f545fa42d2
- Commit message:
- equation logique;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Sep 28 09:33:28 2020 +0000
+++ b/main.cpp Mon Sep 28 10:08:51 2020 +0000
@@ -5,36 +5,14 @@
DigitalOut Led_bleue(LED3);
DigitalIn BP1(D3);
DigitalIn BP2(D2);
-DigitalIn BP3(PTA4);
+DigitalIn BP3(SW3);
int main()
{
while (1) {
- if(!BP1&&!BP2&&BP3) { //led verte
- Led_rouge=1;
- Led_verte=0;
- Led_bleue=1;
- }
- else if(!BP1&&!BP2&&!BP3) { //led rouge
- Led_rouge=0;
- Led_verte=1;
- Led_bleue=1;
- }
- else if(!BP1&&BP2&&BP3) { //led bleue
- Led_rouge=1;
- Led_verte=1;
- Led_bleue=0;
- }
- else if(!BP1&&BP2&&!BP3) { //led blanche
- Led_rouge=0;
- Led_verte=0;
- Led_bleue=0;
- }
- else if(BP1&&!BP2&&BP3) { //led cyan
- Led_rouge=1;
- Led_verte=0;
- Led_bleue=0;
- }
+ Led_rouge=!BP2&&BP3||!BP1&&BP3||BP1&&BP2&&!BP3;
+ Led_verte=!BP2&&!BP3||BP1&&!BP3||!BP1&&BP2&&BP3;
+ Led_bleue=BP1&&BP2||!BP1&&!BP2;
}
}