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@0:30cb0f6dad87, 2016-06-17 (annotated)
- Committer:
- garphil
- Date:
- Fri Jun 17 10:41:31 2016 +0000
- Revision:
- 0:30cb0f6dad87
- Child:
- 1:ab4c9a0a5374
Trial main
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garphil | 0:30cb0f6dad87 | 1 | #include "mbed.h" |
garphil | 0:30cb0f6dad87 | 2 | |
garphil | 0:30cb0f6dad87 | 3 | Ticker toggle_led_ticker; |
garphil | 0:30cb0f6dad87 | 4 | |
garphil | 0:30cb0f6dad87 | 5 | DigitalOut led1(LED1); |
garphil | 0:30cb0f6dad87 | 6 | |
garphil | 0:30cb0f6dad87 | 7 | void toggle_led() { |
garphil | 0:30cb0f6dad87 | 8 | led1 = !led1; |
garphil | 0:30cb0f6dad87 | 9 | } |
garphil | 0:30cb0f6dad87 | 10 | |
garphil | 0:30cb0f6dad87 | 11 | int main() { |
garphil | 0:30cb0f6dad87 | 12 | // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms) |
garphil | 0:30cb0f6dad87 | 13 | toggle_led_ticker.attach(&toggle_led, 0.1); |
garphil | 0:30cb0f6dad87 | 14 | while (true) { |
garphil | 0:30cb0f6dad87 | 15 | // Do other things... |
garphil | 0:30cb0f6dad87 | 16 | } |
garphil | 0:30cb0f6dad87 | 17 | } |