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@1:bc8b34ea89fb, 2020-10-30 (annotated)
- Committer:
- titig
- Date:
- Fri Oct 30 15:10:15 2020 +0000
- Revision:
- 1:bc8b34ea89fb
- Parent:
- 0:5391ae63bb4d
blinking led after pressing button
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| titig | 0:5391ae63bb4d | 1 | #include "mbed.h" |
| titig | 0:5391ae63bb4d | 2 | |
| titig | 0:5391ae63bb4d | 3 | DigitalOut trafficYellowLight(p5); |
| titig | 0:5391ae63bb4d | 4 | DigitalIn pedestrianButton(p6); |
| titig | 0:5391ae63bb4d | 5 | |
| titig | 0:5391ae63bb4d | 6 | int main() { |
| titig | 1:bc8b34ea89fb | 7 | trafficYellowLight=1; |
| titig | 0:5391ae63bb4d | 8 | while (1) { |
| titig | 0:5391ae63bb4d | 9 | trafficYellowLight = !pedestrianButton; |
| titig | 1:bc8b34ea89fb | 10 | |
| titig | 1:bc8b34ea89fb | 11 | if (pedestrianButton){ //once button is set to ON |
| titig | 1:bc8b34ea89fb | 12 | while(1){ |
| titig | 1:bc8b34ea89fb | 13 | trafficYellowLight =!trafficYellowLight; |
| titig | 1:bc8b34ea89fb | 14 | wait(1); |
| titig | 0:5391ae63bb4d | 15 | } |
| titig | 1:bc8b34ea89fb | 16 | } |
| titig | 1:bc8b34ea89fb | 17 | wait_ms(50); |
| titig | 1:bc8b34ea89fb | 18 | } |
| titig | 1:bc8b34ea89fb | 19 | } |