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:
- 4:232f69c6c92c
- Parent:
- 3:a1263051d681
- Child:
- 5:0225e0fdab62
File content as of revision 4:232f69c6c92c:
#include "mbed.h" DigitalOut trafficYellowlight(p5); //Yellow light pin declaration DigitalIn pedestrainButton(p8); //Switch button pin declaration DigitalOut trafficRedlight(p10); //Red light pin declaration int main() { trafficYellowlight=1; //Initialize Yellow light to ON trafficRedlight=0; //Initialize Red light to OFF 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); } }