programme bts bruchet descroix duhautois

Dependencies:   mbed ID12RFID SDFileSystem

Files at this revision

API Documentation at this revision

Comitter:
valentinbruchet
Date:
Mon May 10 13:52:02 2021 +0000
Parent:
5:e104ec24b3fa
Child:
7:5132b1d68c11
Commit message:
Programme BTS BRUCHET DESCROIX DUHAUTOIS

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed May 05 08:13:43 2021 +0000
+++ b/main.cpp	Mon May 10 13:52:02 2021 +0000
@@ -22,9 +22,6 @@
 int valeur_clavier;
 int i;
 unsigned int lecture;
-int chrono = 99;
-int led = 99;
-int tab[40] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40};
 int code1 = 49;
 int code2 = 50;
 int code3 = 51;
@@ -226,31 +223,48 @@
         return; 
 }
 int main()
-{
+{    
     pc.baud(9600);
     ledmasse = 1;
     SetupGenie();
     genieAttachEventHandler(&myGenieEventHandler);
     genieWriteContrast(15);
+    genieWriteObject(GENIE_OBJ_USER_LED, 0, 1);
     
     while(1)
     {
         if (flag == 1) 
         {
             led1 = 1;
+            wait(tempo1);
+            led1 = 0;
             led2 = 1;
+            wait(tempo2);
+            led2 = 0;
             led3 = 1;
+            wait(tempo3);
+            led3 = 0;
             led4 = 1;
+            wait(tempo4);
+            led4 = 0;
+            led5 = 1;
+            wait(tempo5);
             led5 = 0;
+            led6 = 1;
+            wait(tempo6);
             led6 = 0;
+            led7 = 1;
+            wait(tempo7);
             led7 = 0;
+            led8 = 1;
+            wait(tempo8);
             led8 = 0;
-            wait(1);
+            /*wait(1);
             if (chrono == 0)
             {
                 chrono=tab[i];
                 i=i+1;
-            }
+            }*/
         }
 
         else if(flag == 0)
@@ -259,24 +273,38 @@
             led2 = 0;
             led3 = 0;
             led4 = 0;
-            led5 = 1;
-            led6 = 1;
-            led7 = 1;
-            led8 = 1;
-            chrono=tab[i];
-            wait(1);
+            led5 = 0;
+            led6 = 0;
+            led7 = 0;
+            led8 = 0;
+            //chrono=tab[i];
+            //wait(1);
         }
         else if(flag == 2)
         {
-            if(rfid.read() == rfid1) 
+            if(rfid.readable()) 
             {
                 printf("RFID Tag number : %d\n\r", rfid.read());
-                genieWriteObject(GENIE_OBJ_LED, 0x00, 1); 
             }
+            
+            /*switch (rfid.read()) 
+            {        
+            case 1659775:        
+                genieWriteObject(GENIE_OBJ_LED, 0x00, led); 
+                break;        
+            case 20275460:        
+                genieWriteObject(GENIE_OBJ_LED, 0x00, led); 
+                break; 
+            case 3483687:        
+                genieWriteObject(GENIE_OBJ_LED, 0x00, led); 
+                break; 
+            case 17903953:        
+                genieWriteObject(GENIE_OBJ_LED, 0x00, led); 
+                break; 
+            case 23544435:        
+                genieWriteObject(GENIE_OBJ_LED, 0x00, led); 
+                break; 
+            }*/
         }
-        /*if(rfid.read() == rfid1)
-            {
-                genieWriteObject(GENIE_OBJ_LED, 0x00, chrono); 
-            }*/
     }
 }
\ No newline at end of file