Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:602c96685466
- Parent:
- 1:18bf4c2c22ec
- Child:
- 3:b1c994da96f5
diff -r 18bf4c2c22ec -r 602c96685466 main.cpp
--- a/main.cpp Sun Nov 01 13:08:01 2020 +0000
+++ b/main.cpp Sun Nov 01 13:11:26 2020 +0000
@@ -2,12 +2,25 @@
DigitalOut trafficYellowlight(p7);
DigitalIn pedestrainButton(p8);
int main() {
+ trafficYellowlight=1;
while(1)
{
+ if(pedestrainButton&trafficYellowlight){
+ int counter=0;
+ printf("counter is now%d\n",counter);
+ // blink for 5 seconds
+ while(counter<10){
+ counter+=1;
+ trafficYellowlight=!trafficYellowlight;
+ wait_ms(5000);//delay of 5 seconds
+ }
+ trafficYellowlight=0;//switch off
+ }
+ if(!trafficYellowlight){
+ trafficYellowlight=!pedestrainButton;
+ }
- trafficYellowlight=1;
- trafficYellowlight=!pedestrainButton;
wait_ms(5000);
}
- }
+}