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: MX12 ServoRingBuffer mbed-src
Fork of SpindleBot by
main.cpp@0:8a555873b7d3, 2013-02-15 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Feb 15 14:39:20 2013 +0000
- Revision:
- 0:8a555873b7d3
- Child:
- 2:dfeadd6c651c
Hello World for Timeout
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbed_official | 0:8a555873b7d3 | 1 | #include "mbed.h" |
| mbed_official | 0:8a555873b7d3 | 2 | |
| mbed_official | 0:8a555873b7d3 | 3 | Timeout flipper; |
| mbed_official | 0:8a555873b7d3 | 4 | DigitalOut led1(LED1); |
| mbed_official | 0:8a555873b7d3 | 5 | DigitalOut led2(LED2); |
| mbed_official | 0:8a555873b7d3 | 6 | |
| mbed_official | 0:8a555873b7d3 | 7 | void flip() { |
| mbed_official | 0:8a555873b7d3 | 8 | led2 = !led2; |
| mbed_official | 0:8a555873b7d3 | 9 | } |
| mbed_official | 0:8a555873b7d3 | 10 | |
| mbed_official | 0:8a555873b7d3 | 11 | int main() { |
| mbed_official | 0:8a555873b7d3 | 12 | led2 = 1; |
| mbed_official | 0:8a555873b7d3 | 13 | flipper.attach(&flip, 2.0); // setup flipper to call flip after 2 seconds |
| mbed_official | 0:8a555873b7d3 | 14 | |
| mbed_official | 0:8a555873b7d3 | 15 | // spin in a main loop. flipper will interrupt it to call flip |
| mbed_official | 0:8a555873b7d3 | 16 | while(1) { |
| mbed_official | 0:8a555873b7d3 | 17 | led1 = !led1; |
| mbed_official | 0:8a555873b7d3 | 18 | wait(0.2); |
| mbed_official | 0:8a555873b7d3 | 19 | } |
| mbed_official | 0:8a555873b7d3 | 20 | } |
