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:19a3b76f6ca9, 2016-11-18 (annotated)
- Committer:
- dkato
- Date:
- Fri Nov 18 08:50:00 2016 +0000
- Revision:
- 0:19a3b76f6ca9
- Child:
- 1:ec156833bab2
first commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dkato | 0:19a3b76f6ca9 | 1 | #include "mbed.h" |
| dkato | 0:19a3b76f6ca9 | 2 | |
| dkato | 0:19a3b76f6ca9 | 3 | InterruptIn button(USER_BUTTON0); |
| dkato | 0:19a3b76f6ca9 | 4 | DigitalOut led1(LED1); |
| dkato | 0:19a3b76f6ca9 | 5 | |
| dkato | 0:19a3b76f6ca9 | 6 | static void interrupt_button(void) { |
| dkato | 0:19a3b76f6ca9 | 7 | // do nothing |
| dkato | 0:19a3b76f6ca9 | 8 | } |
| dkato | 0:19a3b76f6ca9 | 9 | |
| dkato | 0:19a3b76f6ca9 | 10 | int main() { |
| dkato | 0:19a3b76f6ca9 | 11 | int test_cnt = 0; |
| dkato | 0:19a3b76f6ca9 | 12 | |
| dkato | 0:19a3b76f6ca9 | 13 | button.fall(&interrupt_button); |
| dkato | 0:19a3b76f6ca9 | 14 | button.rise(&interrupt_button); |
| dkato | 0:19a3b76f6ca9 | 15 | |
| dkato | 0:19a3b76f6ca9 | 16 | while (true) { |
| dkato | 0:19a3b76f6ca9 | 17 | // Transition to Sleep Mode |
| dkato | 0:19a3b76f6ca9 | 18 | __WFI(); |
| dkato | 0:19a3b76f6ca9 | 19 | led1 = !led1; |
| dkato | 0:19a3b76f6ca9 | 20 | printf("%d\n", test_cnt++); |
| dkato | 0:19a3b76f6ca9 | 21 | } |
| dkato | 0:19a3b76f6ca9 | 22 | } |