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:c186d9b63164, 2022-10-06 (annotated)
- Committer:
- a_ferguson
- Date:
- Thu Oct 06 14:05:24 2022 +0000
- Revision:
- 1:c186d9b63164
- Parent:
- 0:1cf58db95ce6
- Child:
- 2:af576070220a
Blinks at 1s and 0.3s intervals
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| a_ferguson | 0:1cf58db95ce6 | 1 | #include "mbed.h" |
| a_ferguson | 0:1cf58db95ce6 | 2 | |
| a_ferguson | 0:1cf58db95ce6 | 3 | Serial pc(USBTX,USBRX); //do not need when we aren't communicating with pc |
| a_ferguson | 1:c186d9b63164 | 4 | DigitalOut myled1(LED1); |
| a_ferguson | 1:c186d9b63164 | 5 | DigitalOut myled2(LED2); |
| a_ferguson | 0:1cf58db95ce6 | 6 | DigitalIn button(p17); // button attached to p17 |
| a_ferguson | 0:1cf58db95ce6 | 7 | |
| a_ferguson | 0:1cf58db95ce6 | 8 | int main() { |
| a_ferguson | 0:1cf58db95ce6 | 9 | |
| a_ferguson | 0:1cf58db95ce6 | 10 | while(1) { |
| a_ferguson | 1:c186d9b63164 | 11 | if (button.read()==1){ |
| a_ferguson | 1:c186d9b63164 | 12 | myled2=!myled2; |
| a_ferguson | 1:c186d9b63164 | 13 | wait(1); |
| a_ferguson | 1:c186d9b63164 | 14 | } //if |
| a_ferguson | 1:c186d9b63164 | 15 | if (button.read()==0){ |
| a_ferguson | 1:c186d9b63164 | 16 | myled2=!myled2; |
| a_ferguson | 1:c186d9b63164 | 17 | wait(0.3); |
| a_ferguson | 1:c186d9b63164 | 18 | } //if |
| a_ferguson | 1:c186d9b63164 | 19 | |
| a_ferguson | 1:c186d9b63164 | 20 | } //while |
| a_ferguson | 1:c186d9b63164 | 21 | } //main |
