![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
인터럽트예제
Dependencies: Adafruit_GFX mbed
Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by
interrupt.cpp@14:de61135af30f, 2017-10-13 (annotated)
- Committer:
- deddangte
- Date:
- Fri Oct 13 02:45:14 2017 +0000
- Revision:
- 14:de61135af30f
???? ??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
deddangte | 14:de61135af30f | 1 | // Flash an LED while waiting for events |
deddangte | 14:de61135af30f | 2 | |
deddangte | 14:de61135af30f | 3 | #include "mbed.h" |
deddangte | 14:de61135af30f | 4 | |
deddangte | 14:de61135af30f | 5 | InterruptIn event(D5); |
deddangte | 14:de61135af30f | 6 | DigitalOut led(D13); |
deddangte | 14:de61135af30f | 7 | |
deddangte | 14:de61135af30f | 8 | void trigger() { |
deddangte | 14:de61135af30f | 9 | printf("triggered!\n"); |
deddangte | 14:de61135af30f | 10 | } |
deddangte | 14:de61135af30f | 11 | |
deddangte | 14:de61135af30f | 12 | int main() { |
deddangte | 14:de61135af30f | 13 | event.rise(&trigger); |
deddangte | 14:de61135af30f | 14 | while(1) { |
deddangte | 14:de61135af30f | 15 | led = !led; |
deddangte | 14:de61135af30f | 16 | wait(0.25); |
deddangte | 14:de61135af30f | 17 | } |
deddangte | 14:de61135af30f | 18 | } |