Junichi Katsu
/
LedSw
スイッチを押すごとにLEDが点灯、消灯するプログラムです。
main.cpp@0:136cc3c0143c, 2012-08-18 (annotated)
- Committer:
- jksoft
- Date:
- Sat Aug 18 13:55:32 2012 +0000
- Revision:
- 0:136cc3c0143c
Rev1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:136cc3c0143c | 1 | #include "mbed.h" |
jksoft | 0:136cc3c0143c | 2 | |
jksoft | 0:136cc3c0143c | 3 | DigitalIn enable(p5); |
jksoft | 0:136cc3c0143c | 4 | DigitalOut led(p6); |
jksoft | 0:136cc3c0143c | 5 | |
jksoft | 0:136cc3c0143c | 6 | int main() |
jksoft | 0:136cc3c0143c | 7 | { |
jksoft | 0:136cc3c0143c | 8 | enable.mode(PullUp); |
jksoft | 0:136cc3c0143c | 9 | while(1) { |
jksoft | 0:136cc3c0143c | 10 | if(enable) { |
jksoft | 0:136cc3c0143c | 11 | led = !led; |
jksoft | 0:136cc3c0143c | 12 | } |
jksoft | 0:136cc3c0143c | 13 | wait(0.25); |
jksoft | 0:136cc3c0143c | 14 | } |
jksoft | 0:136cc3c0143c | 15 | } |