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:19ca1693f47b, 2019-01-08 (annotated)
- Committer:
- hample
- Date:
- Tue Jan 08 22:58:42 2019 +0000
- Revision:
- 0:19ca1693f47b
miun
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hample | 0:19ca1693f47b | 1 | #include "mbed.h" |
| hample | 0:19ca1693f47b | 2 | |
| hample | 0:19ca1693f47b | 3 | |
| hample | 0:19ca1693f47b | 4 | InterruptIn myinterrupt(PC9); |
| hample | 0:19ca1693f47b | 5 | |
| hample | 0:19ca1693f47b | 6 | DigitalIn mybutton(PC10); |
| hample | 0:19ca1693f47b | 7 | |
| hample | 0:19ca1693f47b | 8 | DigitalOut myled(LED1); |
| hample | 0:19ca1693f47b | 9 | DigitalOut otherled(LED0); |
| hample | 0:19ca1693f47b | 10 | |
| hample | 0:19ca1693f47b | 11 | Ticker myticker; |
| hample | 0:19ca1693f47b | 12 | |
| hample | 0:19ca1693f47b | 13 | void ledToggle() |
| hample | 0:19ca1693f47b | 14 | { |
| hample | 0:19ca1693f47b | 15 | myled.write(!myled); |
| hample | 0:19ca1693f47b | 16 | //printf("Toggle"); |
| hample | 0:19ca1693f47b | 17 | } |
| hample | 0:19ca1693f47b | 18 | |
| hample | 0:19ca1693f47b | 19 | void ledToggle2() |
| hample | 0:19ca1693f47b | 20 | { |
| hample | 0:19ca1693f47b | 21 | otherled.write(!otherled); |
| hample | 0:19ca1693f47b | 22 | } |
| hample | 0:19ca1693f47b | 23 | |
| hample | 0:19ca1693f47b | 24 | int main() |
| hample | 0:19ca1693f47b | 25 | { |
| hample | 0:19ca1693f47b | 26 | myticker.attach(&ledToggle2, 2.0); |
| hample | 0:19ca1693f47b | 27 | |
| hample | 0:19ca1693f47b | 28 | myinterrupt.fall(&ledToggle); |
| hample | 0:19ca1693f47b | 29 | myinterrupt.rise(&ledToggle); |
| hample | 0:19ca1693f47b | 30 | |
| hample | 0:19ca1693f47b | 31 | while(1){ |
| hample | 0:19ca1693f47b | 32 | |
| hample | 0:19ca1693f47b | 33 | |
| hample | 0:19ca1693f47b | 34 | |
| hample | 0:19ca1693f47b | 35 | //otherled.write(1); |
| hample | 0:19ca1693f47b | 36 | //wait(1); |
| hample | 0:19ca1693f47b | 37 | //otherled.write(0); |
| hample | 0:19ca1693f47b | 38 | //wait(1); |
| hample | 0:19ca1693f47b | 39 | |
| hample | 0:19ca1693f47b | 40 | |
| hample | 0:19ca1693f47b | 41 | } |
| hample | 0:19ca1693f47b | 42 | } |