Nyakuri Jean Pierre
/
finalcodesforassigment
assignment
Diff: main.cpp
- Revision:
- 2:fbcf17529c1a
- Parent:
- 1:d5bb191dfa70
--- a/main.cpp Sun Nov 01 09:22:35 2020 +0000 +++ b/main.cpp Sun Nov 01 10:16:54 2020 +0000 @@ -1,8 +1,10 @@ #include "mbed.h" DigitalOut trafficYellowlight(p5); +DigitalOut trafficRedlight(p7); DigitalIn pedestrainButton(p6); int main() { trafficYellowlight=1; + trafficRedlight=0; while(1) { if(pedestrainButton&trafficYellowlight){ @@ -15,12 +17,13 @@ wait_ms(500);//delay of 1 second } trafficYellowlight=0;//switch off + trafficRedlight=1; } if(!trafficYellowlight){ trafficYellowlight=!pedestrainButton; + trafficRedlight=!trafficYellowlight; } wait_ms(500); } } -uot \ No newline at end of file