![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
assignment
Revision 2:fbcf17529c1a, committed 2020-11-01
- Comitter:
- nyakuri
- Date:
- Sun Nov 01 10:16:54 2020 +0000
- Parent:
- 1:d5bb191dfa70
- Commit message:
- final codes for assignment
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d5bb191dfa70 -r fbcf17529c1a main.cpp --- 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