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.
main.cpp
- Committer:
- titig
- Date:
- 2020-11-01
- Revision:
- 3:a1263051d681
- Parent:
- 2:a98660025857
- Child:
- 4:232f69c6c92c
File content as of revision 3:a1263051d681:
#include "mbed.h" DigitalOut trafficYellowlight(p5); //Yellow light pin declaration DigitalIn pedestrainButton(p8); //Switch button pin declaration int main() { trafficYellowlight=1; //Initialize Yellow light to ON while(1) { if(pedestrainButton & trafficYellowlight){ int counter=0; // declaration and initialization of counter while(counter<10){ counter+=1; trafficYellowlight=!trafficYellowlight; //Blinking Yellow light for 10 second wait_ms(500); //delay of 5 second } trafficYellowlight=0; //switch off yellow light } if(!trafficYellowlight){ trafficYellowlight=!pedestrainButton; // Yellow light reamin switched OFF but once button is pressed to be OFF Yellow light will be ON } wait_ms(500); } }