割り込み制御

Dependencies:   mbed

main.cpp

Committer:
spyglass77
Date:
2015-08-28
Revision:
2:04dcded3ccae
Parent:
1:8f5fb022c757

File content as of revision 2:04dcded3ccae:

#include "mbed.h"

InterruptIn emergencyBTN(PC_13);//割り込み_青色ボタン
DigitalOut emergencyLED(PA_8);//外部LED
DigitalOut statusLED(PA_5);//内部LED

void emergencyLoop(){  //割り込みループ処理
    emergencyLED = !emergencyLED;//外部LEDを反転
}

int main() {
    emergencyBTN.fall(&emergencyLoop);//ボタンが押されたら割り込みループへ
    while(1) {
        statusLED = !statusLED;//内部LEDを反転
        wait(0.5);
    }
}