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 Ticker_HelloWorld by
main.cpp@0:5014bf742e9b, 2013-02-14 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Feb 14 14:30:22 2013 +0000
- Revision:
- 0:5014bf742e9b
- Child:
- 2:87f26931d8d1
Ticket Hello World
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbed_official | 0:5014bf742e9b | 1 | #include "mbed.h" |
| mbed_official | 0:5014bf742e9b | 2 | |
| mbed_official | 0:5014bf742e9b | 3 | Ticker flipper; |
| mbed_official | 0:5014bf742e9b | 4 | DigitalOut led1(LED1); |
| mbed_official | 0:5014bf742e9b | 5 | DigitalOut led2(LED2); |
| mbed_official | 0:5014bf742e9b | 6 | |
| mbed_official | 0:5014bf742e9b | 7 | void flip() { |
| mbed_official | 0:5014bf742e9b | 8 | led2 = !led2; |
| mbed_official | 0:5014bf742e9b | 9 | } |
| mbed_official | 0:5014bf742e9b | 10 | |
| mbed_official | 0:5014bf742e9b | 11 | int main() { |
| mbed_official | 0:5014bf742e9b | 12 | led2 = 1; |
| mbed_official | 0:5014bf742e9b | 13 | flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds) |
| mbed_official | 0:5014bf742e9b | 14 | |
| mbed_official | 0:5014bf742e9b | 15 | // spin in a main loop. flipper will interrupt it to call flip |
| mbed_official | 0:5014bf742e9b | 16 | while(1) { |
| mbed_official | 0:5014bf742e9b | 17 | led1 = !led1; |
| mbed_official | 0:5014bf742e9b | 18 | wait(0.2); |
| mbed_official | 0:5014bf742e9b | 19 | } |
| mbed_official | 0:5014bf742e9b | 20 | } |
