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.
Fork of Task121 by
main.cpp@8:31e49e1d9386, 2019-09-10 (annotated)
- Committer:
- noutram
- Date:
- Tue Sep 10 14:17:44 2019 +0000
- Revision:
- 8:31e49e1d9386
- Parent:
- 7:bc61039bc0dc
- Child:
- 9:5ac40ff61514
Pin mapping changed back to D7
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| noutram | 6:6aeae28837c4 | 1 | // Updated 2019 for Mbed-os 5.1X |
| noutram | 6:6aeae28837c4 | 2 | |
| noutram | 0:c742e33896a9 | 3 | //This is known as a “header file” |
| noutram | 0:c742e33896a9 | 4 | //In short, this copies and pastes the text file |
| noutram | 0:c742e33896a9 | 5 | //mbed.h into this code |
| noutram | 0:c742e33896a9 | 6 | #include "mbed.h" |
| noutram | 0:c742e33896a9 | 7 | |
| noutram | 0:c742e33896a9 | 8 | //Create a DigitalOut “object” called myled |
| noutram | 0:c742e33896a9 | 9 | //Pass constant D7 as a “parameter” |
| noutram | 8:31e49e1d9386 | 10 | DigitalOut myled(D7); |
| noutram | 0:c742e33896a9 | 11 | |
| noutram | 0:c742e33896a9 | 12 | //The main function - all executable C / C++ |
| noutram | 0:c742e33896a9 | 13 | //applications have a main function. This is |
| noutram | 0:c742e33896a9 | 14 | //out entry point in the software |
| noutram | 0:c742e33896a9 | 15 | int main() { |
| noutram | 0:c742e33896a9 | 16 | |
| noutram | 0:c742e33896a9 | 17 | // ALL the code is contained in a |
| noutram | 0:c742e33896a9 | 18 | // “while loop” |
| noutram | 0:c742e33896a9 | 19 | while(1) |
| noutram | 0:c742e33896a9 | 20 | { |
| noutram | 0:c742e33896a9 | 21 | //The code between the { curly braces } |
| noutram | 0:c742e33896a9 | 22 | //is the code that is repeated |
| noutram | 0:c742e33896a9 | 23 | myled = 1; // External LED is ON |
| noutram | 0:c742e33896a9 | 24 | wait(1.0); // 1 second |
| noutram | 0:c742e33896a9 | 25 | myled = 0; // LED is OFF |
| noutram | 0:c742e33896a9 | 26 | wait(1.0); // External 1 second |
| noutram | 0:c742e33896a9 | 27 | } |
| noutram | 1:a3b418536134 | 28 | } |
| noutram | 1:a3b418536134 | 29 | |
| noutram | 1:a3b418536134 | 30 | |
| noutram | 7:bc61039bc0dc | 31 |
