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: mbed
Fork of Ticker_3 by
main.cpp@0:0ba4641adab9, 2017-10-13 (annotated)
- Committer:
- ajy912
- Date:
- Fri Oct 13 02:39:35 2017 +0000
- Revision:
- 0:0ba4641adab9
- Child:
- 1:3b84da6d133f
interrupt_ledr_ledg
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ajy912 | 0:0ba4641adab9 | 1 | // Flash an LED while waiting for events |
| ajy912 | 0:0ba4641adab9 | 2 | |
| ajy912 | 0:0ba4641adab9 | 3 | #include "mbed.h" |
| ajy912 | 0:0ba4641adab9 | 4 | |
| ajy912 | 0:0ba4641adab9 | 5 | InterruptIn event(D5); |
| ajy912 | 0:0ba4641adab9 | 6 | DigitalOut ledr(D13); |
| ajy912 | 0:0ba4641adab9 | 7 | DigitalOut ledg(D11); |
| ajy912 | 0:0ba4641adab9 | 8 | |
| ajy912 | 0:0ba4641adab9 | 9 | void trigger() { |
| ajy912 | 0:0ba4641adab9 | 10 | printf("triggered!\n"); |
| ajy912 | 0:0ba4641adab9 | 11 | ledg =! ledg; |
| ajy912 | 0:0ba4641adab9 | 12 | |
| ajy912 | 0:0ba4641adab9 | 13 | } |
| ajy912 | 0:0ba4641adab9 | 14 | |
| ajy912 | 0:0ba4641adab9 | 15 | int main() { |
| ajy912 | 0:0ba4641adab9 | 16 | event.rise(&trigger); |
| ajy912 | 0:0ba4641adab9 | 17 | while(1) { |
| ajy912 | 0:0ba4641adab9 | 18 | ledr =! ledr; |
| ajy912 | 0:0ba4641adab9 | 19 | wait(0.25); |
| ajy912 | 0:0ba4641adab9 | 20 | } |
| ajy912 | 0:0ba4641adab9 | 21 | } |
