team majorel / Mbed 2 deprecated miniprojet

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
xavier_majorel
Date:
Wed Sep 09 13:09:51 2020 +0000
Parent:
33:710cfcf55052
Commit message:
mini projet

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 09 12:09:09 2020 +0000
+++ b/main.cpp	Wed Sep 09 13:09:51 2020 +0000
@@ -1,19 +1,81 @@
 #include "mbed.h"
 
-DigitalOut Led_blanche(D2);
+DigitalOut Led_bleue(PTB21);
+DigitalOut Led_vert(PTE26);
+DigitalOut Led_rouge(PTB22);
+DigitalIn BP1(D3);
+DigitalIn BP2(SW2);
+DigitalIn BP3(SW3);
 
-DigitalIn BP2(D3);
+int main() 
+{
+    
 
-int main() {
-    while(1) {
-        if (BP2==1) 
+    
+    while(1) 
+    {
+         if ((!BP1)&&(BP2)&&(BP3)) 
+         {
+            Led_bleue=1;
+            Led_rouge=1;
+            Led_vert=1; 
+         }
+      
+        if ((!BP1)&&(!BP2)&&(BP3)) 
+         {
+            Led_bleue=0;
+            Led_rouge=1;
+            Led_vert=1; 
+         }
+       
+        
+        
+       if ((!BP1)&&(BP2)&&(!BP3)) 
+        {
+            Led_bleue=1;
+            Led_rouge=1;
+            Led_vert=0; 
+        }
+        
+        if ((!BP1)&&(!BP2)&&(!BP3)) 
         {
-            Led_blanche=1; 
+            Led_bleue=1;
+            Led_rouge=0;
+            Led_vert=1; 
+        }
+        
+        if ((BP1)&&(BP2)&&(BP3)) 
+        {
+            Led_bleue=0;
+            Led_rouge=1;
+            Led_vert=0; 
+        }
+       
+        if ((BP1)&&(BP2)&&(!BP3)) 
+        {
+            Led_bleue=0;
+            Led_rouge=0;
+            Led_vert=1; 
         }
-        else 
+       
+       if ((BP1)&&(!BP2)&&(BP3))
+        {
+            Led_bleue=1;
+            Led_rouge=0;
+            Led_vert=0; 
+        }
+    
+      if ((BP1)&&(!BP2)&&(!BP3)) 
         {
-            Led_blanche=0; 
+            Led_bleue=0;
+            Led_rouge=0;
+            Led_vert=0; 
         }
+       
+
+       
+        
+     
         
     } // fin de boucle infinie 
 }     // fin programme