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.
Dependencies: Nucleof446_input_test mbed
Fork of Nucleof446_input_test by
main.cpp@1:8af40c4036bf, 2017-02-27 (annotated)
- Committer:
- johanyapson
- Date:
- Mon Feb 27 03:59:34 2017 +0000
- Revision:
- 1:8af40c4036bf
- Parent:
- 0:ac081be73cf3
- Child:
- 2:287fe12e0a40
Changed D4 to D3
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| johanyapson | 0:ac081be73cf3 | 1 | #include "mbed.h" |
| johanyapson | 0:ac081be73cf3 | 2 | |
| johanyapson | 1:8af40c4036bf | 3 | DigitalOut myled(D3); |
| johanyapson | 0:ac081be73cf3 | 4 | DigitalIn input(D2); |
| johanyapson | 0:ac081be73cf3 | 5 | |
| johanyapson | 0:ac081be73cf3 | 6 | int main() { |
| johanyapson | 0:ac081be73cf3 | 7 | while(1) { |
| johanyapson | 0:ac081be73cf3 | 8 | if (input) |
| johanyapson | 0:ac081be73cf3 | 9 | { |
| johanyapson | 0:ac081be73cf3 | 10 | myled = 1; // LED is ON |
| johanyapson | 0:ac081be73cf3 | 11 | } |
| johanyapson | 0:ac081be73cf3 | 12 | else |
| johanyapson | 0:ac081be73cf3 | 13 | { |
| johanyapson | 0:ac081be73cf3 | 14 | myled = 0; |
| johanyapson | 0:ac081be73cf3 | 15 | } |
| johanyapson | 0:ac081be73cf3 | 16 | // myled = 1; // LED is ON |
| johanyapson | 0:ac081be73cf3 | 17 | // wait(0.2); // 200 ms |
| johanyapson | 0:ac081be73cf3 | 18 | // myled = 0; // LED is OFF |
| johanyapson | 0:ac081be73cf3 | 19 | // wait(1.0); // 1 sec |
| johanyapson | 0:ac081be73cf3 | 20 | } |
| johanyapson | 0:ac081be73cf3 | 21 | } |
