割り込み制御
Dependencies: mbed
main.cpp@2:04dcded3ccae, 2015-08-28 (annotated)
- Committer:
- spyglass77
- Date:
- Fri Aug 28 17:31:46 2015 +0000
- Revision:
- 2:04dcded3ccae
- Parent:
- 1:8f5fb022c757
add commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spyglass77 | 0:88cb63e043c1 | 1 | #include "mbed.h" |
spyglass77 | 1:8f5fb022c757 | 2 | |
spyglass77 | 1:8f5fb022c757 | 3 | InterruptIn emergencyBTN(PC_13);//割り込み_青色ボタン |
spyglass77 | 1:8f5fb022c757 | 4 | DigitalOut emergencyLED(PA_8);//外部LED |
spyglass77 | 1:8f5fb022c757 | 5 | DigitalOut statusLED(PA_5);//内部LED |
spyglass77 | 1:8f5fb022c757 | 6 | |
spyglass77 | 2:04dcded3ccae | 7 | void emergencyLoop(){ //割り込みループ処理 |
spyglass77 | 1:8f5fb022c757 | 8 | emergencyLED = !emergencyLED;//外部LEDを反転 |
spyglass77 | 1:8f5fb022c757 | 9 | } |
spyglass77 | 1:8f5fb022c757 | 10 | |
spyglass77 | 0:88cb63e043c1 | 11 | int main() { |
spyglass77 | 1:8f5fb022c757 | 12 | emergencyBTN.fall(&emergencyLoop);//ボタンが押されたら割り込みループへ |
spyglass77 | 0:88cb63e043c1 | 13 | while(1) { |
spyglass77 | 1:8f5fb022c757 | 14 | statusLED = !statusLED;//内部LEDを反転 |
spyglass77 | 1:8f5fb022c757 | 15 | wait(0.5); |
spyglass77 | 0:88cb63e043c1 | 16 | } |
spyglass77 | 1:8f5fb022c757 | 17 | } |