![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
인터럽트예제
Dependencies: Adafruit_GFX mbed
Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by
Revision 14:de61135af30f, committed 2017-10-13
- Comitter:
- deddangte
- Date:
- Fri Oct 13 02:45:14 2017 +0000
- Parent:
- 13:52e9c29e2f88
- Commit message:
- ???? ??
Changed in this revision
interrupt.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interrupt.cpp Fri Oct 13 02:45:14 2017 +0000 @@ -0,0 +1,18 @@ +// Flash an LED while waiting for events + +#include "mbed.h" + +InterruptIn event(D5); +DigitalOut led(D13); + +void trigger() { + printf("triggered!\n"); +} + +int main() { + event.rise(&trigger); + while(1) { + led = !led; + wait(0.25); + } +}
--- a/main.cpp Wed Apr 19 04:07:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#include "mbed.h" -#include "Adafruit_SSD1306.h" - -DigitalOut myled_R(LED_RED); - -I2C i2c(PA_10,PA_9); - -Adafruit_SSD1306_I2c myOled(i2c,NC,0x78,64,128); - - -int main() -{ - uint16_t x=0; - - myOled.begin(); - myOled.printf("%ux%u \nHellow World\r\n", myOled.width(), myOled.height()); - myOled.display(); - - while(1) - { - myled_R = !myled_R; - myOled.printf("%u\r",x); - myOled.display(); - x = x + 1; - wait(1.0); - } -}