InterruptIn program for mbed NXP LPC11U24 beta
main.cpp@0:8ee2824fa192, 2011-10-20 (annotated)
- Committer:
- chris
- Date:
- Thu Oct 20 11:07:07 2011 +0000
- Revision:
- 0:8ee2824fa192
- Child:
- 1:2885d2e0189f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:8ee2824fa192 | 1 | #include "mbed.h" |
chris | 0:8ee2824fa192 | 2 | |
chris | 0:8ee2824fa192 | 3 | DigitalOut led3(LED3); |
chris | 0:8ee2824fa192 | 4 | InterruptIn din(p14); |
chris | 0:8ee2824fa192 | 5 | |
chris | 0:8ee2824fa192 | 6 | void int_handler () { |
chris | 0:8ee2824fa192 | 7 | led3 = 1; |
chris | 0:8ee2824fa192 | 8 | wait(0.25); |
chris | 0:8ee2824fa192 | 9 | led3 = 0; |
chris | 0:8ee2824fa192 | 10 | } |
chris | 0:8ee2824fa192 | 11 | |
chris | 0:8ee2824fa192 | 12 | int main () { |
chris | 0:8ee2824fa192 | 13 | |
chris | 0:8ee2824fa192 | 14 | din.rise(&int_handler); |
chris | 0:8ee2824fa192 | 15 | |
chris | 0:8ee2824fa192 | 16 | while (1) { |
chris | 0:8ee2824fa192 | 17 | // do nothing |
chris | 0:8ee2824fa192 | 18 | } |
chris | 0:8ee2824fa192 | 19 | |
chris | 0:8ee2824fa192 | 20 | } |