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.
Blinking2Ledswith_SwitchButton.cpp@1:f2ac268b3b17, 2021-06-04 (annotated)
- Committer:
 - kgabriel
 - Date:
 - Fri Jun 04 16:33:22 2021 +0000
 - Revision:
 - 1:f2ac268b3b17
 - Parent:
 - 0:f792b1ecc7b3
 
Good Program
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| kgabriel | 0:f792b1ecc7b3 | 1 | #include "mbed.h" | 
| kgabriel | 0:f792b1ecc7b3 | 2 | |
| kgabriel | 0:f792b1ecc7b3 | 3 | DigitalOut redLed(p5); | 
| kgabriel | 0:f792b1ecc7b3 | 4 | DigitalOut yellowLed(p7); | 
| kgabriel | 0:f792b1ecc7b3 | 5 | DigitalIn switchButton(p6); | 
| kgabriel | 0:f792b1ecc7b3 | 6 | |
| kgabriel | 0:f792b1ecc7b3 | 7 | int main() { | 
| kgabriel | 0:f792b1ecc7b3 | 8 | |
| kgabriel | 0:f792b1ecc7b3 | 9 | while (1) { | 
| kgabriel | 0:f792b1ecc7b3 | 10 | if(switchButton==1){ | 
| kgabriel | 0:f792b1ecc7b3 | 11 | redLed=1; | 
| kgabriel | 0:f792b1ecc7b3 | 12 | yellowLed=0; | 
| kgabriel | 0:f792b1ecc7b3 | 13 | } | 
| kgabriel | 0:f792b1ecc7b3 | 14 | else{ | 
| kgabriel | 0:f792b1ecc7b3 | 15 | redLed=0; | 
| kgabriel | 0:f792b1ecc7b3 | 16 | yellowLed=1; | 
| kgabriel | 0:f792b1ecc7b3 | 17 | } | 
| kgabriel | 0:f792b1ecc7b3 | 18 | |
| kgabriel | 0:f792b1ecc7b3 | 19 | wait(1); | 
| kgabriel | 0:f792b1ecc7b3 | 20 | } | 
| kgabriel | 0:f792b1ecc7b3 | 21 | } |