デジタル入力のサンプルプログラム
Dependencies: mbed
main.cpp@1:cfda69754e51, 2019-07-30 (annotated)
- Committer:
- GGU
- Date:
- Tue Jul 30 04:14:41 2019 +0000
- Revision:
- 1:cfda69754e51
- Parent:
- 0:a4438272274f
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GGU | 1:cfda69754e51 | 1 | //SW ON→LED is OFF |
GGU | 0:a4438272274f | 2 | #include "mbed.h" |
GGU | 0:a4438272274f | 3 | |
GGU | 0:a4438272274f | 4 | DigitalIn enable(D12); |
GGU | 0:a4438272274f | 5 | DigitalOut myled(LED1); |
GGU | 0:a4438272274f | 6 | |
GGU | 0:a4438272274f | 7 | int main() { |
GGU | 0:a4438272274f | 8 | while(1) { |
GGU | 0:a4438272274f | 9 | if(enable){ //SW is ON |
GGU | 0:a4438272274f | 10 | myled=!myled; //LED is OFF |
GGU | 0:a4438272274f | 11 | } |
GGU | 0:a4438272274f | 12 | wait(0.25); //0.25sec |
GGU | 0:a4438272274f | 13 | } |
GGU | 0:a4438272274f | 14 | } |