Felix HARERIMANA / Mbed 2 deprecated LORACODES

Dependencies:   mbed

Revision:
4:21c7f1725060
Parent:
3:b1c994da96f5
Child:
5:e1afaceb1196
--- a/main.cpp	Sun Nov 01 13:16:01 2020 +0000
+++ b/main.cpp	Sun Nov 01 13:26:46 2020 +0000
@@ -1,10 +1,10 @@
 #include "mbed.h"
 DigitalOut trafficYellowlight(p7);
-#include "mbed.h"
-DigitalOut trafficYellowlight(p7);
+DigitalOut trafficRedlight(p9);
 DigitalIn pedestrainButton(p8);
 int main() {
     trafficYellowlight=1;
+    trafficRedlight=0;
     while(1) 
     {
         if(pedestrainButton&trafficYellowlight){
@@ -17,12 +17,13 @@
                 wait_ms(5000);//delay of 5 second
             }
             trafficYellowlight=0;//switch off
+             
              }
              if(!trafficYellowlight){
-                 trafficYellowlight=!pedestrainButton;
+                 trafficYellowlight=!pedestrainButton; // yellow and red lights are switched opposetely
+                
              }
         
-             wait_ms(5000);
+             wait_ms(5000); // wait for 5 second
                }
-}
-
+}
\ No newline at end of file