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@3:c9a411d4fe64, 2012-10-23 (annotated)
- Committer:
- emilmont
- Date:
- Tue Oct 23 09:37:07 2012 +0000
- Revision:
- 3:c9a411d4fe64
- Parent:
- 2:b085bc47e75b
- Child:
- 6:1f29b4f65251
Update mbed library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| chris | 0:5e8c7a36cb58 | 1 | #include "mbed.h" |
| chris | 0:5e8c7a36cb58 | 2 | |
| chris | 0:5e8c7a36cb58 | 3 | Ticker tick; |
| chris | 0:5e8c7a36cb58 | 4 | DigitalOut led1(LED_RED); |
| chris | 0:5e8c7a36cb58 | 5 | DigitalOut led2(LED_GREEN); |
| chris | 0:5e8c7a36cb58 | 6 | |
| emilmont | 3:c9a411d4fe64 | 7 | void flip() { |
| chris | 0:5e8c7a36cb58 | 8 | led2 = !led2; |
| chris | 0:5e8c7a36cb58 | 9 | } |
| chris | 0:5e8c7a36cb58 | 10 | |
| emilmont | 3:c9a411d4fe64 | 11 | int main() { |
| chris | 0:5e8c7a36cb58 | 12 | tick.attach(&flip, 0.7); // setup ticker to call flip led2 after 0.7 seconds |
| chris | 0:5e8c7a36cb58 | 13 | |
| chris | 0:5e8c7a36cb58 | 14 | // spin in a main loop. |
| emilmont | 3:c9a411d4fe64 | 15 | while (true) { |
| chris | 0:5e8c7a36cb58 | 16 | led1 = !led1; |
| chris | 0:5e8c7a36cb58 | 17 | wait (0.3); // flip led1 every 0.3 seconds |
| chris | 0:5e8c7a36cb58 | 18 | } |
| chris | 2:b085bc47e75b | 19 | } |