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@2:1f9267d3f3f4, 2020-05-07 (annotated)
- Committer:
- CSTritt
- Date:
- Thu May 07 14:39:17 2020 +0000
- Revision:
- 2:1f9267d3f3f4
- Parent:
- 1:9f6f3af9aaaa
- Child:
- 3:665ae1f64bf0
Returning for 2020.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rossatmsoe | 0:293359e38af0 | 1 | /* |
CSTritt | 2:1f9267d3f3f4 | 2 | Project: Blink_FET |
CSTritt | 2:1f9267d3f3f4 | 3 | File: main.cpp |
CSTritt | 2:1f9267d3f3f4 | 4 | Last revised by: Dr. C. S. Tritt |
CSTritt | 2:1f9267d3f3f4 | 5 | Last revision on: 4/8/19 (v. 1.0) |
CSTritt | 2:1f9267d3f3f4 | 6 | |
CSTritt | 2:1f9267d3f3f4 | 7 | Turns on D4 for 0.7 second, then off for 0.3 second, repeatedly. |
rossatmsoe | 0:293359e38af0 | 8 | |
rossatmsoe | 0:293359e38af0 | 9 | This example code is in the public domain. |
rossatmsoe | 0:293359e38af0 | 10 | */ |
rossatmsoe | 0:293359e38af0 | 11 | #include "mbed.h" |
CSTritt | 2:1f9267d3f3f4 | 12 | // Construct a digital output object called myD4 and connect it to D4. |
CSTritt | 2:1f9267d3f3f4 | 13 | DigitalOut myD4(D4); |
CSTritt | 2:1f9267d3f3f4 | 14 | |
rossatmsoe | 0:293359e38af0 | 15 | int main() { // This curly brace marks the beginning of the main function. |
CSTritt | 2:1f9267d3f3f4 | 16 | // Loop forever. |
CSTritt | 1:9f6f3af9aaaa | 17 | while(true) { // This curly brace marks the start of the repeated actions. |
CSTritt | 2:1f9267d3f3f4 | 18 | myD4 = 1; // Turn on D4 by "storing" a 1 in it. |
CSTritt | 2:1f9267d3f3f4 | 19 | wait(0.7); // wait(x) will pause for a given number of seconds. |
CSTritt | 2:1f9267d3f3f4 | 20 | myD4 = 0; // Turn off D4 by "storing" a 0 in it. |
CSTritt | 2:1f9267d3f3f4 | 21 | wait(0.3); // Wait another 0.3 seconds. |
CSTritt | 2:1f9267d3f3f4 | 22 | } // end of repeated actions. |
CSTritt | 2:1f9267d3f3f4 | 23 | } // end of main function. |