SeeeduinoArchで割り込みのテスト
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 InterruptIn button(P0_23); 00004 DigitalOut led(LED1); 00005 DigitalOut flash(LED4); 00006 00007 void flip() { 00008 led = !led; 00009 } 00010 00011 int main() { 00012 button.rise(&flip); // attach the address of the flip function to the rising edge 00013 while(1) { // wait around, interrupts will interrupt this! 00014 flash = !flash; 00015 wait(0.25); 00016 } 00017 }
Generated on Sun Jul 17 2022 01:07:22 by
1.7.2
Takumi Okamoto